+ if (aCurve->isCircle()) {
+ GeomEdgePtr aEdgePtr(new GeomAPI_Edge(aShape));
+ GeomVertexPtr aVertexPtr(new GeomAPI_Vertex(theP.X(), theP.Y(), theP.Z()));
+ BRepExtrema_ExtPC aExtrema(aVertexPtr->impl<TopoDS_Vertex>(),
+ aEdgePtr->impl<TopoDS_Edge>());
+ int aNb = aExtrema.NbExt();
+ if (aNb > 0) {
+ for (int i = 1; i <= aNb; i++) {
+ if (aExtrema.IsMin(i)) {
+ double aParam = aExtrema.Parameter(i);
+ Handle(Geom_Curve) aCurv = aCurve->impl<Handle_Geom_Curve>();
+ gp_Pnt aP;
+ aCurv->D1(aParam, aP, aVec);
+ break;
+ }
+ }
+ }
+ } else {
+ double aMidParam = (aCurve->startParam() + aCurve->endParam()) / 2.;
+ GeomPointPtr aPnt1 = aCurve->getPoint((aMidParam + aCurve->endParam()) / 2.);
+ GeomPointPtr aPnt2 = aCurve->getPoint((aMidParam + aCurve->startParam()) / 2.);