1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00

0027021: TopExp::Vertices performance optimization

TopExp::Vertices optimized for sequential calls. BRep_Tool::Curve performance regression fixed. Update for fetching point done.

Casts modified to pointers

Test case for issue CR27021

gcc warnings elimination
This commit is contained in:
pdn
2015-12-21 15:41:39 +03:00
committed by bugmaster
parent 57736dfc91
commit 8447359f09
4 changed files with 302 additions and 114 deletions

View File

@@ -147,15 +147,33 @@ void TopExp::Vertices(const TopoDS_Edge& E,
TopoDS_Vertex& Vlast,
const Standard_Boolean CumOri)
{
Vfirst = Vlast = TopoDS_Vertex(); // nullify
TopoDS_Iterator ite(E,CumOri);
// minor optimization for case when Vfirst and Vlast are non-null:
// at least for VC++ 10, it is faster if we use boolean flags than
// if we nullify vertices at that point (see #27021)
Standard_Boolean isFirstDefined = Standard_False;
Standard_Boolean isLastDefined = Standard_False;
TopoDS_Iterator ite(E, CumOri);
while (ite.More()) {
if (ite.Value().Orientation() == TopAbs_FORWARD)
Vfirst = TopoDS::Vertex(ite.Value());
else if (ite.Value().Orientation() == TopAbs_REVERSED)
Vlast = TopoDS::Vertex(ite.Value());
const TopoDS_Shape& aV = ite.Value();
if (aV.Orientation() == TopAbs_FORWARD)
{
Vfirst = TopoDS::Vertex (aV);
isFirstDefined = Standard_True;
}
else if (aV.Orientation() == TopAbs_REVERSED)
{
Vlast = TopoDS::Vertex (aV);
isLastDefined = Standard_True;
}
ite.Next();
}
if (!isFirstDefined)
Vfirst.Nullify();
if (!isLastDefined)
Vlast.Nullify();
}