Archived issue #0023167
Hole in Triangulation
Description
Hello,
when I import the attached step file the triangulation doesn't work correctly for the 397th face (started counting from 1). Their is a hole at the bottom left and a triangle is drawn accross the face.
when I import the attached step file the triangulation doesn't work correctly for the 397th face (started counting from 1). Their is a hole at the bottom left and a triangle is drawn accross the face.
Steps to reproduce
Handle(TDocStd_Document) hDoc;
XCAFApp_Application::GetApplication()->NewDocument("MDTV_XCAF", hDoc);
STEPCAFControl_Reader reader;
reader.SetColorMode(true);
reader.ReadFile(strFileName);
reader.Transfer(hDoc);
for (TDF_ChildIterator it(XCAFDoc_DocumentTool::ShapesLabel(hDoc->Main())); it.More() && !progress.canceled(); it.Next())
{
if (XCAFDoc_ShapeTool::IsSimpleShape(it.Value()))
{
TopoDS_Shape shapeCurrent;
XCAFDoc_ShapeTool::GetShape(it.Value(), shapeCurrent);
TopExp_Explorer expFace;
expFace.Init(shapeCurrent, TopAbs_FACE);
int nMin(397), nMax(397); //The exception occurs in face 397
for (Standard_Integer numFace = 1; expFace.More(); expFace.Next(), ++numFace)
{
if (numFace < nMin || numFace > nMax)
continue;
TopoDS_Face myFace = TopoDS::Face(expFace.Current());
Handle(Poly_Triangulation) myT = BRep_Tool::Triangulation(myFace, myLocation);
if (myT.IsNull())
{
BRepMesh_IncrementalMesh Mesh(myFace, 0.7, Standard_False, 0.75);
myT = BRep_Tool::Triangulation(myFace, myLocation);
}
}
}
}
XCAFApp_Application::GetApplication()->NewDocument("MDTV_XCAF", hDoc);
STEPCAFControl_Reader reader;
reader.SetColorMode(true);
reader.ReadFile(strFileName);
reader.Transfer(hDoc);
for (TDF_ChildIterator it(XCAFDoc_DocumentTool::ShapesLabel(hDoc->Main())); it.More() && !progress.canceled(); it.Next())
{
if (XCAFDoc_ShapeTool::IsSimpleShape(it.Value()))
{
TopoDS_Shape shapeCurrent;
XCAFDoc_ShapeTool::GetShape(it.Value(), shapeCurrent);
TopExp_Explorer expFace;
expFace.Init(shapeCurrent, TopAbs_FACE);
int nMin(397), nMax(397); //The exception occurs in face 397
for (Standard_Integer numFace = 1; expFace.More(); expFace.Next(), ++numFace)
{
if (numFace < nMin || numFace > nMax)
continue;
TopoDS_Face myFace = TopoDS::Face(expFace.Current());
Handle(Poly_Triangulation) myT = BRep_Tool::Triangulation(myFace, myLocation);
if (myT.IsNull())
{
BRepMesh_IncrementalMesh Mesh(myFace, 0.7, Standard_False, 0.75);
myT = BRep_Tool::Triangulation(myFace, myLocation);
}
}
}
}
Additional information
This error might have the same reason as Bug 0023105, but in contrast to this Bug, no exception is occuring here, there is just a wronng triangulation shown
Public activity
6 archived notes
Participants are labeled by their role within this record.
The triangulation problem seems to have been fixed by #22884, at least I could not reproduce it after updating to current master.
However, I noticed another problem: neither incmesh nor tricheck nor trinfo commands in DRAW notice the problem in triangulation when it existed.
I have attached file Attachment 2 (BREP) which is face 397 from the STEP file coming with bug report, with triangulation computed by previous snapshot of OCCT (should be similar to that produced by OCCT 6.5.3).
Do in DRAW:
restore Attachment 2 (BREP) a
vdisplay a
# shape looks bad!
axo
fit
isos a 0
triangles a
# free edges can be seen
trinfo a
tricheck a
# no problems are reported -- why?
However, I noticed another problem: neither incmesh nor tricheck nor trinfo commands in DRAW notice the problem in triangulation when it existed.
I have attached file Attachment 2 (BREP) which is face 397 from the STEP file coming with bug report, with triangulation computed by previous snapshot of OCCT (should be similar to that produced by OCCT 6.5.3).
Do in DRAW:
restore Attachment 2 (BREP) a
vdisplay a
# shape looks bad!
axo
fit
isos a 0
triangles a
# free edges can be seen
trinfo a
tricheck a
# no problems are reported -- why?
Dear Andrey,
trinfo command just collects information about number of triangles and display it - nothing more - no tricks, no checks.
incmesh can indicate a problem in case of classification problems such as open wire or self intersection. If some kind of exception occurs during meshing procedure, incmesh will break all computations.
tricheck command intended to collect info about free edges, nodes and takes info about absent triangulation on face.
IMHO, this kind of triangulation failure can't be recognized, because it's formally correct: face has triangulation and each edge of face has at least one triangle. This means absent triangles are considered as usual holes and therefore it's difficult to classify them as invalid areas.
trinfo command just collects information about number of triangles and display it - nothing more - no tricks, no checks.
incmesh can indicate a problem in case of classification problems such as open wire or self intersection. If some kind of exception occurs during meshing procedure, incmesh will break all computations.
tricheck command intended to collect info about free edges, nodes and takes info about absent triangulation on face.
IMHO, this kind of triangulation failure can't be recognized, because it's formally correct: face has triangulation and each edge of face has at least one triangle. This means absent triangles are considered as usual holes and therefore it's difficult to classify them as invalid areas.
I've compiled version 6.5.3 with the code changes from issue #22884 and the problem doesn't appear anymore.
I believe that command tricheck can be improved to detect holes in the triangulation that do not correspond to wires (i.e. there are no edges that have polygon-on-triangulation on the links along the hole).
Please add a test case for this issue, then I propose it is switched to VERIFIED
Test case was pushed to branch CR23409.
Tricheck command was fixed in bug OCC23409.
Tricheck command was fixed in bug OCC23409.
Related records