# Edge Orientation

Hi,

I have a strange problem creating an edge.

I have a gp_Lin2d (pos : -200.0,0.0) and main vector (0.0,1.0) (vertical line).
I have 2 points on this line from which i want to create the edge.
The first point on (-200,0) and the second in (-200,-100).

I compute the parameter of the two points according the line with

GeomLib_Tool::Parameter(handleToCurve,FirstPoint,tolerance,FirstPointU)

And the values are ok. O for the first point and -100.0 for the second;

Then i create the edge like this :
BRepBuilderAPI_MakeEdge2d edgeConstruct(handleToCurve,FirstPoint,SecondPoint/*,FirstPointU,SecondPointU*/);

But when i check the edge orientation it return TopAbs_Forward whereas in this case it must be TopAbs_Reversed because SecondPoint parameter is less than the FirstPoint parameter as it is documented.

BRepBuilderAPI_MakeEdge(const Handle_Geom_Curve& L,const gp_Pnt& P1,const gp_Pnt& P2);
If the parameter of point P2 on the curve is less than the parameter of point P1, the orientation of the edge will be TopAbs_REVERSED. It's my case !!!!

So i don't understand why i get a wrong orientation. Is the vertical line is a special case because in the documentation it is said that forward orientation is from left to right but in the case of the vertical line don't have sense??

Thanks.

I have no idea why you get wrong orientation but left/right has nothing to do with the line itself, what they mean is that if you imagine that you stand at the lowest parameter of the line/curve looking at the highest parameter you have inside on your left side and outside on your right side, and the way you look is "forward", so if you reverse the orientation you just flip the place you "look from", standing at the highest parameter looking at the lowest.

I suggest you put a break point in the void BRepLib_MakeEdge2d::Init(const Handle(Geom2d_Curve)& CC, const TopoDS_Vertex& VV1, const TopoDS_Vertex& VV2, const Standard_Real pp1, const Standard_Real pp2) method in BRepLib_MakeEdge2d.cxx file.

This is where you will end up at the end and there is an if(...) that checks the order of the parameters and flips orientation, have a look there and see what is going on.

Have you tried giving it parameters (0,-100) instead of the points and if so, do you get the same result ?

Hi Mikael,