Archived issue #0026148
BRep_Tool::IsClosed failed to judge a closed edge on Poly_Triangulation.
Description
Standard_Boolean BRep_Tool::IsClosed (const TopoDS_Edge& E, const Handle(Poly_Triangulation)& T) returns wrong result if the edge has its own location.
It's easy to reproduce this issue.
1. Create a cylinder.
2. Translate the cylinder to a different location.
3. Mesh the cylinder.
4. Check the seam edge with abouve function BRep_Tool::IsClosed.
The failure reason is the above the function doesn't consider the location of the Poly_Triangulation.
To fix this issue, it needs to change the method signature by adding a more argument TopLoc_Location as below:
Standard_Boolean IsClosed(const TopoDS_Edge& E, const Handle(Poly_Triangulation)& T, const TopLoc_Location& L)
{
//TopLoc_Location l = E.Location(); // Original code
TopLoc_Location l = L.Predivided(E.Location()); // Correction code
// find the representation
BRep_ListIteratorOfListOfCurveRepresentation itcr
((*((Handle(BRep_TEdge)*)&E.TShape()))->ChangeCurves());
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr->IsPolygonOnTriangulation(T, l) &&
cr->IsPolygonOnClosedTriangulation())
return Standard_True;
itcr.Next();
}
return Standard_False;
}
It's easy to reproduce this issue.
1. Create a cylinder.
2. Translate the cylinder to a different location.
3. Mesh the cylinder.
4. Check the seam edge with abouve function BRep_Tool::IsClosed.
The failure reason is the above the function doesn't consider the location of the Poly_Triangulation.
To fix this issue, it needs to change the method signature by adding a more argument TopLoc_Location as below:
Standard_Boolean IsClosed(const TopoDS_Edge& E, const Handle(Poly_Triangulation)& T, const TopLoc_Location& L)
{
//TopLoc_Location l = E.Location(); // Original code
TopLoc_Location l = L.Predivided(E.Location()); // Correction code
// find the representation
BRep_ListIteratorOfListOfCurveRepresentation itcr
((*((Handle(BRep_TEdge)*)&E.TShape()))->ChangeCurves());
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr->IsPolygonOnTriangulation(T, l) &&
cr->IsPolygonOnClosedTriangulation())
return Standard_True;
itcr.Next();
}
return Standard_False;
}
Steps to reproduce
Not needed.
Public activity
4 archived notes
Participants are labeled by their role within this record.
Branch [archived branch] has been created by Participant.
[revision removed]
Detailed log of new commits:
Author: msv
Date: Thu Apr 30 12:37:07 2015 +0300
0026148: BRep_Tool::IsClosed failed to judge a closed edge on Poly_Triangulation.
The method signature has been changed by adding an argument TopLoc_Location.
[revision removed]
Detailed log of new commits:
Author: msv
Date: Thu Apr 30 12:37:07 2015 +0300
0026148: BRep_Tool::IsClosed failed to judge a closed edge on Poly_Triangulation.
The method signature has been changed by adding an argument TopLoc_Location.
Reviewed.
Dear Commenter 1,
Branch CR26148 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode.
[revision removed]
Number of compiler warnings:
occt component :
Linux: 18 (18 on master)
Windows: 0 (0 on master)
products component :
Linux: 4 (4 on master)
Windows: 0 (0 on master)
Regressions/Differences:
No regressions/differences
Testing cases:
Not needed
Testing on Linux:
occt component :
Total MEMORY difference: 95153858 / 94535080 [+0.65%]
Total CPU difference: 51999.31999999906 / 51017.29999999946 [+1.92%]
products component :
Total MEMORY difference: 23791015 / 23753447 [+0.16%]
Total CPU difference: 16840.560000000012 / 17120.949999999957 [-1.64%]
Testing on Windows:
occt component :
Total MEMORY difference: 57253160 / 57266605 [-0.02%]
Total CPU difference: 15786.817596899058 / 15810.95095159897 [-0.15%]
products component :
Total MEMORY difference: 15601304 / 15605919 [-0.03%]
Total CPU difference: 6157.312669699965 / 6275.40542669997 [-1.88%]
There are no differences in images found by testdiff.
Branch CR26148 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode.
[revision removed]
Number of compiler warnings:
occt component :
Linux: 18 (18 on master)
Windows: 0 (0 on master)
products component :
Linux: 4 (4 on master)
Windows: 0 (0 on master)
Regressions/Differences:
No regressions/differences
Testing cases:
Not needed
Testing on Linux:
occt component :
Total MEMORY difference: 95153858 / 94535080 [+0.65%]
Total CPU difference: 51999.31999999906 / 51017.29999999946 [+1.92%]
products component :
Total MEMORY difference: 23791015 / 23753447 [+0.16%]
Total CPU difference: 16840.560000000012 / 17120.949999999957 [-1.64%]
Testing on Windows:
occt component :
Total MEMORY difference: 57253160 / 57266605 [-0.02%]
Total CPU difference: 15786.817596899058 / 15810.95095159897 [-0.15%]
products component :
Total MEMORY difference: 15601304 / 15605919 [-0.03%]
Total CPU difference: 6157.312669699965 / 6275.40542669997 [-1.88%]
There are no differences in images found by testdiff.
Branch [archived branch] has been deleted by Participant.
[revision removed]
[revision removed]