// Created on: 1994-03-17 // Created by: Bruno DUMORTIER // Copyright (c) 1994-1999 Matra Datavision // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the GNU Lesser General Public License version 2.1 as published // by the Free Software Foundation, with special exception defined in the file // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT // distribution for complete text of the license and disclaimer of any warranty. // // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. #ifndef _GeomAPI_ProjectPointOnCurve_HeaderFile #define _GeomAPI_ProjectPointOnCurve_HeaderFile #include "Standard.hxx" #include "Standard_DefineAlloc.hxx" #include "Standard_Handle.hxx" #include "Standard_Integer.hxx" #include "Extrema_ExtPC.hxx" #include "GeomAdaptor_Curve.hxx" class gp_Pnt; class Geom_Curve; //! This class implements methods for computing all the orthogonal //! projections of a 3D point onto a 3D curve. class GeomAPI_ProjectPointOnCurve { public: DEFINE_STANDARD_ALLOC //! Creates an empty object. Use an //! Init function for further initialization. Standard_EXPORT GeomAPI_ProjectPointOnCurve(); //! Create the projection of a point

on a curve //! Standard_EXPORT GeomAPI_ProjectPointOnCurve(const gp_Pnt& P, const occ::handle& Curve); //! Create the projection of a point

on a curve //! limited by the two points of parameter Umin and Usup. Standard_EXPORT GeomAPI_ProjectPointOnCurve(const gp_Pnt& P, const occ::handle& Curve, const double Umin, const double Usup); //! Init the projection of a point

on a curve //! Standard_EXPORT void Init(const gp_Pnt& P, const occ::handle& Curve); //! Init the projection of a point

on a curve //! limited by the two points of parameter Umin and Usup. Standard_EXPORT void Init(const gp_Pnt& P, const occ::handle& Curve, const double Umin, const double Usup); //! Init the projection of a point

on a curve //! limited by the two points of parameter Umin and Usup. Standard_EXPORT void Init(const occ::handle& Curve, const double Umin, const double Usup); //! Performs the projection of a point on the current curve. Standard_EXPORT void Perform(const gp_Pnt& P); //! Returns the number of computed //! orthogonal projection points. //! Note: if this algorithm fails, NbPoints returns 0. Standard_EXPORT int NbPoints() const; Standard_EXPORT operator int() const; //! Returns the orthogonal projection //! on the curve. Index is a number of a computed point. //! Exceptions //! Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where //! NbPoints is the number of solution points. Standard_EXPORT gp_Pnt Point(const int Index) const; //! Returns the parameter on the curve //! of the point, which is the orthogonal projection. Index is a //! number of a computed point. //! Exceptions //! Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where //! NbPoints is the number of solution points. Standard_EXPORT double Parameter(const int Index) const; //! Returns the parameter on the curve //! of the point, which is the orthogonal projection. Index is a //! number of a computed point. //! Exceptions //! Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where //! NbPoints is the number of solution points.- Standard_EXPORT void Parameter(const int Index, double& U) const; //! Computes the distance between the //! point and its orthogonal projection on the curve. Index is a number of a computed point. //! Exceptions //! Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where //! NbPoints is the number of solution points. Standard_EXPORT double Distance(const int Index) const; //! Returns the nearest orthogonal //! projection of the point on the curve. //! Exceptions: StdFail_NotDone if this algorithm fails. Standard_EXPORT gp_Pnt NearestPoint() const; Standard_EXPORT operator gp_Pnt() const; //! Returns the parameter on the curve //! of the nearest orthogonal projection of the point. //! Exceptions: StdFail_NotDone if this algorithm fails. Standard_EXPORT double LowerDistanceParameter() const; //! Computes the distance between the //! point and its nearest orthogonal projection on the curve. //! Exceptions: StdFail_NotDone if this algorithm fails. Standard_EXPORT double LowerDistance() const; Standard_EXPORT operator double() const; //! return the algorithmic object from Extrema const Extrema_ExtPC& Extrema() const; private: bool myIsDone; int myIndex; Extrema_ExtPC myExtPC; GeomAdaptor_Curve myC; }; #include "GeomAPI_ProjectPointOnCurve.lxx" #endif // _GeomAPI_ProjectPointOnCurve_HeaderFile