MantisBT
Mantis Bug Tracker Workflow

View Revisions: Issue #8722 All Revisions ] Back to Issue ]
Summary 0008722: Optimization of StdPrs_ToolRFace::Next() method
Revision 2011-12-15 16:36 by abv
Description It is proposed to improve StdPrs_ToolRFace::Next() method, so as to avoid
unnecessary recursion.

********************

Original message posted by Ernest at www.opencascade.org forum:
http://www.opencascade.org/org/forum/thread_8054/ [^]

some optimization ( StdPrs_ToolRFace)

instead of

void StdPrs_ToolRFace::Next()
{
myExplorer.Next();

if (myExplorer.More()) {
// skip INTERNAL and EXTERNAL edges
if (myExplorer.Current().Orientation() == TopAbs_INTERNAL) Next();
if (myExplorer.Current().Orientation() == TopAbs_EXTERNAL) Next();
if (myExplorer.More()) {
Standard_Real U1,U2;
const Handle(Geom2d_Curve)& C =
BRep_Tool::CurveOnSurface(TopoDS::Edge(myExplorer.Current()),
myFace,
U1,U2);
#ifdef OCC316
if ( !C.IsNull() )
#endif
DummyCurve.Load(C,U1,U2);
}
}
}


it looks much better as: (less stack usage)

void StdPrs_ToolRFace::Next()
{
myExplorer.Next();

if (myExplorer.More()) {
// skip INTERNAL and EXTERNAL edges
while (myExpolrer.More() && (myExplorer.Current().Orientation() ==
TopAbs_INTERNAL || myExplorer.Current().Orientation() == TopAbs_EXTERNAL))
myExplorer.Next();
if (myExplorer.More()) {
Standard_Real U1,U2;
const Handle(Geom2d_Curve)& C =
BRep_Tool::CurveOnSurface(TopoDS::Edge(myExplorer.Current()),
myFace,
U1,U2);
#ifdef OCC316
if ( !C.IsNull() )
#endif
DummyCurve.Load(C,U1,U2);
}
}
}


at least i'd prefer the second code.
Revision 2006-06-29 09:15 by abv
Description It is proposed to improve StdPrs_ToolRFace::Next() method, so as to avoid
unnecessary recursion.

********************

Original message posted by Ernest at www.opencascade.org forum:
http://www.opencascade.org/org/forum/thread_8054/ [^]

some optimization ( StdPrs_ToolRFace)

instead of

void StdPrs_ToolRFace::Next()
{
myExplorer.Next();

if (myExplorer.More()) {
// skip INTERNAL and EXTERNAL edges
if (myExplorer.Current().Orientation() == TopAbs_INTERNAL) Next();
if (myExplorer.Current().Orientation() == TopAbs_EXTERNAL) Next();
if (myExplorer.More()) {
Standard_Real U1,U2;
const Handle(Geom2d_Curve)& C =
BRep_Tool::CurveOnSurface(TopoDS::Edge(myExplorer.Current()),
myFace,
U1,U2);
#ifdef OCC316
if ( !C.IsNull() )
#endif
DummyCurve.Load(C,U1,U2);
}
}
}


it looks much better as: (less stack usage)

void StdPrs_ToolRFace::Next()
{
myExplorer.Next();

if (myExplorer.More()) {
// skip INTERNAL and EXTERNAL edges
while (myExpolrer.More() && (myExplorer.Current().Orientation() ==
TopAbs_INTERNAL || myExplorer.Current().Orientation() == TopAbs_EXTERNAL))
myExplorer.Next();
if (myExplorer.More()) {
Standard_Real U1,U2;
const Handle(Geom2d_Curve)& C =
BRep_Tool::CurveOnSurface(TopoDS::Edge(myExplorer.Current()),
myFace,
U1,U2);
#ifdef OCC316
if ( !C.IsNull() )
#endif
DummyCurve.Load(C,U1,U2);
}
}
}


at least i'd prefer the second code.


Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker