When I go around the edges of a torus, the order seems to be wrong.
This is the code i use to go around the edges in the parameter space (notice I do use WireExplorer):
#include "occ_header.h"
int main() {
TopExp_Explorer Ex;
TopExp_Explorer Ex2;
TopExp_Explorer Ex3;
BRepTools_WireExplorer Ex4;
TopoDS_Shell Shell;
TopoDS_Face Face;
TopoDS_Wire Wire;
TopoDS_Edge Edge;
Standard_Real First;
Standard_Real Last;
gp_Pnt2d P;
TopoDS_Solid Solid= BRepPrimAPI_MakeTorus(10.,1.);
for (Ex.Init(Solid, TopAbs_SHELL); Ex.More(); Ex.Next())
{
Shell= TopoDS::Shell(Ex.Current());
for (Ex2.Init(Shell, TopAbs_FACE); Ex2.More(); Ex2.Next())
{
Face= TopoDS::Face(Ex2.Current());
for (Ex3.Init(Face, TopAbs_WIRE); Ex3.More(); Ex3.Next())
{
Wire= TopoDS::Wire(Ex3.Current());
for (Ex4.Init(Wire); Ex4.More(); Ex4.Next())
{
Edge= TopoDS::Edge(Ex4.Current());
cout
//const Handle(Geom_Curve)& Curve=BRep_Tool::Curve(Edge,First,Last);
const Handle(Geom2d_Curve)& Curve2d=BRep_Tool::CurveOnSurface(Edge,Face,First,Last);
Curve2d->D0(First,P);
cout
cout
Curve2d->D0(Last,P);
cout
cout
}
}
}
}
return 0;
}
and here's the output
for each edge, i compute the (u,v) at beginning and end of underlying curve
Orient is the edge orientation
recall that 0 means FORWARD and 1 means REVERSED
if it says FORWARD, you have to go from First to Last
if it says REVERSED, you have to go from Last to First in order to loop around the torus.
Orient= 1
First= 0
u= 0 v= 6.28319
Last= 6.28319
u= 6.28319 v= 6.28319
Orient= 0
First= 0
u= 6.28319 v= 0
Last= 6.28319
u= 6.28319 v= 6.28319
Orient= 0
First= 0
u= 0 v= 0
Last= 6.28319
u= 6.28319 v= 0
Orient= 1
First= 0
u= 0 v= 0
Last= 6.28319
u= 0 v= 6.28319
So, the loop goes like this:
(6.28,6.28) to (0,6.28) to (6.28,0) which is wrong!
Can somebody take a loop? Either i am doing something wrong or this is a bug.