Orientation of ArcOfCircle

I am trying to construct a half circle going from (0,0,0) to the point (10,0,0) with radius 5 and the shape of the half circle should be concave , I have written the following code:

gp_Pnt pt1(0, 0, 0);
gp_Pnt pt2(10, 0, 0);
gp_Pnt centerPt(5, 0, 0);
gp_Dir dir(0, -1, 0);
gp_Ax2 ax2(centerPt, dir);
gp_Circ circ(ax2, 5);

auto makeArc = GC_MakeArcOfCircle(circ, pt1, pt2, true);
Geom_TrimmedCurve* curve = new Geom_TrimmedCurve(makeArc.Value(), 0, pt1.Distance(pt2), true);

This generates a half circle but the arc is convex, I have tried changing to gp_Dir dir(0, 1, 0) and also tried changing the order of my points. The "sense" parameter I have also tried setting to false, without any success.

Does anyone have any tips to how I can fix the orientation of my arc?

Kristofer Sejersted's picture

*UPDATE*
It seems like my problem is not the orientation but the period. To give some additional context I am trying to find the closest point on the arc to my point (10,0,-2) and instead of getting (10, 0, 0) I get the point on the full circle (9.64, -1.86)

my code for finding the nearest point is as follows:
gp_Pnt point(10, 0, -2);
wrp_geomLine^ geom_line = (wrp_geomLine^)line->ToGeom_Curve();
BRepBuilderAPI_MakeEdge maker(geom_line->Curve());
TopoDS_Shape shape = maker.Shape();
BRepBuilderAPI_MakeVertex vertex(point);
TopoDS_Shape pointAsShape = vertex.Shape();
BRepExtrema_DistShapeShape extrema(shape, pointAsShape);
gp_Pnt closestPoint = extrema.PointOnShape1(1);

Dmitrii Pasukhin's picture
frank pian's picture

@Kristofer Sejersted
You've got the wrong plane. gp_Dir dir(0, 0, 1) or gp_Dir dir(0, 0, -1)
But I'm confused as to why you have to change the direction of the plane or swap the start and end points to change the direction of the arc.What does the "sense" parameter do?