For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

[BUG?] BRep_Projection inverts wire's orientation

Fabian Hachenberg's picture

I use BRepProj_Projection (cylindrical projection) to project a wire describing a square orthogonal to the square's plane onto a parallel plane, so in fact this projection is trivial.
However, in some cases BRepProj_Projection inverts the wires orientation - and i mean the REAL orientation - so "left around" wires become "right around" wires and vice versa.

I did some tests and found out
- if the TopoDS_Wire object has reverse orientation, the wire's orientation is NOT changed by projection. If the TopoDS_Wire object has forward orientation but the edges are defined in reverse direction, the projection IS inverting the orientation.
- if the projection direction vector is identical to the projection target plane's normal vector, the orientation is changed, if they are opposite, the orientation is NOT changed

the square "right around" wire

TopoDS_Wire wire = BRepBuilderAPI_MakeWire(
BRepBuilderAPI_MakeEdge(gp_Lin(gp_Pnt(0,0,0), gp_Dir(0,-1,0)), 0, 1.0),
BRepBuilderAPI_MakeEdge(gp_Lin(gp_Pnt(0,-1,0), gp_Dir(1,0,0)), 0, 1.0),
BRepBuilderAPI_MakeEdge(gp_Lin(gp_Pnt(1,-1,0), gp_Dir(0,1,0)), 0, 1.0),
BRepBuilderAPI_MakeEdge(gp_Lin(gp_Pnt(1,0,0), gp_Dir(-1,0,0)), 0, 1.0));

the same wire running "left around"

TopoDS_Wire wire = BRepBuilderAPI_MakeWire(
BRepBuilderAPI_MakeEdge(gp_Lin(gp_Pnt(0,-1,0), gp_Dir(0,1,0)), 0, 1.0),
BRepBuilderAPI_MakeEdge(gp_Lin(gp_Pnt(0,0,0), gp_Dir(1,0,0)), 0, 1.0),
BRepBuilderAPI_MakeEdge(gp_Lin(gp_Pnt(1,0,0), gp_Dir(0,-1,0)), 0, 1.0),
BRepBuilderAPI_MakeEdge(gp_Lin(gp_Pnt(1,-1,0), gp_Dir(-1,0,0)), 0, 1.0));

the projection

TopoDS_Face plane = BRepBuilderAPI_MakeFace(gp_Pln(gp_Pnt(0,0,0), gp_Dir(0,0,1)), -10.0, 10.0, -10.0, 10.0);
BRepProj_Projection proj(wire, plane, gp_Dir(0,0,1));

Fabian Hachenberg's picture

another result
-if the TopoDS_Wire object has reverse orientation and the projection direction vector is opposite to the target plane's normal vector, the orientation is reversed.

Andrey BETENEV's picture

This is by design: BRepProj_Projection does not even try to preserve orientation of the wire