Fri, 01/19/2024 - 10:55
Forums:
I noticed this very annoying regression in visualization. The object seems topologically correct, but something in the translation to OpenGL must happen? See the attached picture for the end result of the code below (C#, snippet appended to the sample project importExportWPF):
TopoDS_Compound comp = new TopoDS_Compound();
TopoDS_Shape compShape = comp;
BRep_Builder builder = new BRep_Builder();
builder.MakeCompound(ref comp);
gp_Pnt startPoint = new gp_Pnt();
Geom_Circle borderCircle = new Geom_Circle(new gp_Ax2(startPoint, new gp_Dir(0, 0, 1)), 40);
BRepBuilderAPI_MakeEdge edgeMk = new BRepBuilderAPI_MakeEdge(borderCircle.Circ());
BRepBuilderAPI_MakeWire wMaker = new BRepBuilderAPI_MakeWire(edgeMk.Edge());
TopoDS_Wire spine = wMaker.Wire();
BRepBuilderAPI_MakeEdge eMaker = new BRepBuilderAPI_MakeEdge(new gp_Pnt(0, 40, 0), new gp_Pnt(0, 50, 0));
BRepOffsetAPI_MakePipe pipeMk = new BRepOffsetAPI_MakePipe(spine, eMaker.Edge());
builder.Add(ref compShape, pipeMk.Shape());
BRepBuilderAPI_MakeWire mkWire = new BRepBuilderAPI_MakeWire();
mkWire.Add(new BRepBuilderAPI_MakeEdge(new gp_Pnt(0, 40, 0), new gp_Pnt(-40, 0, 0)).Edge());
mkWire.Add(new BRepBuilderAPI_MakeEdge(new gp_Pnt(-40, 0, 0), new gp_Pnt(-15, 0, 0)).Edge());
mkWire.Add(new BRepBuilderAPI_MakeEdge(new gp_Pnt(-15, 0, 0), new gp_Pnt(-15, -37, 0)).Edge());
mkWire.Add(new BRepBuilderAPI_MakeEdge(new gp_Pnt(-15, -37, 0), new gp_Pnt(15, -37, 0)).Edge());
mkWire.Add(new BRepBuilderAPI_MakeEdge(new gp_Pnt(15, -37, 0), new gp_Pnt(15, 0, 0)).Edge());
mkWire.Add(new BRepBuilderAPI_MakeEdge(new gp_Pnt(15, 0, 0), new gp_Pnt(40, 0, 0)).Edge());
mkWire.Add(new BRepBuilderAPI_MakeEdge(new gp_Pnt(40, 0, 0), new gp_Pnt(0, 40, 0)).Edge());
TopoDS_Face faceArrow = new BRepBuilderAPI_MakeFace(mkWire.Wire(), true).Face();
builder.Add(ref compShape, faceArrow);
double scalefactor = 0.25;
gp_Trsf trsfScale = new gp_Trsf();
trsfScale.SetScale(startPoint, scalefactor);
TopLoc_Location locScale = new TopLoc_Location(trsfScale);
comp.Move(locScale);
//var aisShape = new AIS_Shape(faceArrow); // va
var aisShape = new AIS_Shape(compShape); // NON va
aisShape.SetDisplayMode((int)AIS_DisplayMode.AIS_Shaded);
myOcctView.Context.Display(aisShape, 1, 0, true);
Attachments:
Fri, 01/19/2024 - 12:20
The problem is revealed by skipping the Tessellate() in StdPrs_ShadedShape.cxx.
The arrow triangulation is wrong.
Fri, 01/19/2024 - 15:14
AIS_Shape
just displays triangulation computed byBRepMesh_IncrementalMesh
or some another algorithm.So either - you observe some bug in meshing algorithm, or your shape is defined incorrectly (from meshing algorithm point of view).
Reporting an issue for obsolete OCCT release is not much helpful - it is desired to check issue on more recent releases to see if it is still happen or already fixed.
Fri, 01/19/2024 - 18:31
Ok, I checked the code. The problem is in the creation of the Delanauy triangulation. The code in BRepMesh_Delaun.cxx is the same in 7.8.0.
Why do you need to add extra nodes not belonging to the mesh for visualisation? Skipping that line seems to work.
Fri, 01/19/2024 - 16:21
I just dowloaded OCCT 7.8.0, but the ImportExport samples have been removed?
Can you please check the aforementioned snippet with the DRAWEXE?
Fri, 01/19/2024 - 19:26
Hello, Samples are not removed.
We apologies for late publishing. The samples will be public a little later. If you can share the file, it helps us to reproduce the issue.
Best regards, Dmitrii.
Sun, 01/21/2024 - 04:56
My apologies, your code sample generate a model. I will try to reproduce on latest version. But it can be faster to check with already prepared".brep" file.
Best regards, Dmitrii.
Mon, 01/22/2024 - 18:13
Hi Dmitri,
ok thanks. Take into account that the problem is verified by embedding the arrow face into a compound. The face alone works. The BREP file is included. This is a minimal example:
Tue, 01/23/2024 - 12:08
Hello Dmitri,
trying with 7.8.0, I have found what causes the problem. With 7.8.0:
gives an error, because you cannot Move to a TopLoc_Location without defining the translation first. Actually TopoDS_Shape does not have a Transform() method, to perform a scaled rototranslation.
So probably a default has changed from 7.3 to 7.4, but adding this line fixes the issue:
You can close this ticket.
Tue, 01/23/2024 - 13:29
Thank you for your investigation. We will try to analize the reason for this behavior.
comp.Move(locScale); on 7.8 should be done as comp.Move(locScale, true); to accept scaling,
Best regards, Dmitrii.