
Fri, 09/04/2015 - 19:52
Forums:
Hi
I drew a arc. I want to know end Point and start point of arc.
I wrote This Code
gp_Ax2 a2(gp::Origin(), gp::DZ());
gp_Circ c(a2, 10);
double startAngle = 180.0;
double endAngle = 90.0;
TopoDS_Edge arc = BRepBuilderAPI_MakeEdge(c, DEGTORAD(startAngle), DEGTORAD(endAngle));
draw(arc);
BRepAdaptor_Curve curve(arc);
double fp = curve.FirstParameter();
double lp = curve.LastParameter();
gp_Pnt p1, p2;
curve.D0(fp, p1);
curve.D0(lp, p2);
P1, P2 should be p1 (-10, 0, 0) p2 (0, 10, 0)
But I look in debug mode ; p1(-10, 1.22464679914735e-15, 0), p2(3.06161699786838e-15, 10, 0)
thanks
Fri, 09/11/2015 - 18:56
Suleyman,
Check the methods you are using for tolerance arguments. I don't know if you noticed, but the result is correct, except for the excessive precision: 1.224...e-15 is pretty much 0.
I don't know if this is acceptable to your application, but in your place I would simply create a method (if OCCT doesn't have one for that already) to replace excessively small values with 0.
Good luck and I hope this helps,
Rodrigo