GeomAPI_ProjectPointOnCurve aProj(aPoint, aCircle);
Standard_Integer aNbPoint = aProj.NbPoints();
if (aNbPoint > 0) {
- double aMinDistance = 0, aDistance;
+ double aMinDistance = Precision::Infinite(), aDistance;
for (Standard_Integer j = 1; j <= aNbPoint; j++) {
gp_Pnt aNewPoint = aProj.Point(j);
aDistance = aNewPoint.Distance(aPoint);
- if (!aMinDistance || aDistance < aMinDistance) {
+ if (aDistance < aMinDistance) {
aMinDistance = aDistance;
aResult = std::shared_ptr<GeomAPI_Pnt>(
new GeomAPI_Pnt(aNewPoint.X(), aNewPoint.Y(), aNewPoint.Z()));
Handle(Geom_Circle) aCurve = new Geom_Circle(*MY_CIRC);
return GeomLib_Tool::Parameter(aCurve, thePoint->impl<gp_Pnt>(), theTolerance, theParameter) == Standard_True;
}
+
+//=================================================================================================
+std::shared_ptr<GeomAPI_Dir> GeomAPI_Circ::normal() const
+{
+ const gp_Ax1& anAxis = MY_CIRC->Axis();
+ const gp_Dir& aDir = anAxis.Direction();
+ return std::shared_ptr<GeomAPI_Dir>(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z()));
+}