+
+const std::shared_ptr<GeomAPI_Pnt> GeomAPI_Ellipse::project(
+ const std::shared_ptr<GeomAPI_Pnt>& thePoint) const
+{
+ std::shared_ptr<GeomAPI_Pnt> aResult;
+ if (!MY_ELIPS)
+ return aResult;
+
+ Handle(Geom_Ellipse) aEllipse = new Geom_Ellipse(*MY_ELIPS);
+
+ const gp_Pnt& aPoint = thePoint->impl<gp_Pnt>();
+
+ GeomAPI_ProjectPointOnCurve aProj(aPoint, aEllipse);
+ Standard_Integer aNbPoint = aProj.NbPoints();
+ if (aNbPoint > 0) {
+ gp_Pnt aNearest = aProj.NearestPoint();
+ aResult = GeomPointPtr(new GeomAPI_Pnt(aNearest.X(), aNearest.Y(), aNearest.Z()));
+ }
+ return aResult;
+}
+
+const bool GeomAPI_Ellipse::parameter(const std::shared_ptr<GeomAPI_Pnt> thePoint,
+ const double theTolerance,
+ double& theParameter) const
+{
+ Handle(Geom_Ellipse) aCurve = new Geom_Ellipse(*MY_ELIPS);
+ return GeomLib_Tool::Parameter(aCurve, thePoint->impl<gp_Pnt>(),
+ theTolerance, theParameter) == Standard_True;
+}