1 // Created on: 1994-03-17
2 // Created by: Bruno DUMORTIER
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _GeomAPI_ProjectPointOnCurve_HeaderFile
18 #define _GeomAPI_ProjectPointOnCurve_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Standard_Integer.hxx>
25 #include <Extrema_ExtPC.hxx>
26 #include <GeomAdaptor_Curve.hxx>
32 //! This class implements methods for computing all the orthogonal
33 //! projections of a 3D point onto a 3D curve.
34 class GeomAPI_ProjectPointOnCurve
41 //! Creates an empty object. Use an
42 //! Init function for further initialization.
43 Standard_EXPORT GeomAPI_ProjectPointOnCurve();
45 //! Create the projection of a point <P> on a curve
47 Standard_EXPORT GeomAPI_ProjectPointOnCurve(const gp_Pnt& P, const Handle(Geom_Curve)& Curve);
49 //! Create the projection of a point <P> on a curve
50 //! <Curve> limited by the two points of parameter Umin and Usup.
51 Standard_EXPORT GeomAPI_ProjectPointOnCurve(const gp_Pnt& P, const Handle(Geom_Curve)& Curve, const Standard_Real Umin, const Standard_Real Usup);
53 //! Init the projection of a point <P> on a curve
55 Standard_EXPORT void Init (const gp_Pnt& P, const Handle(Geom_Curve)& Curve);
57 //! Init the projection of a point <P> on a curve
58 //! <Curve> limited by the two points of parameter Umin and Usup.
59 Standard_EXPORT void Init (const gp_Pnt& P, const Handle(Geom_Curve)& Curve, const Standard_Real Umin, const Standard_Real Usup);
61 //! Init the projection of a point <P> on a curve
62 //! <Curve> limited by the two points of parameter Umin and Usup.
63 Standard_EXPORT void Init (const Handle(Geom_Curve)& Curve, const Standard_Real Umin, const Standard_Real Usup);
65 //! Performs the projection of a point on the current curve.
66 Standard_EXPORT void Perform (const gp_Pnt& P);
68 //! Returns the number of computed
69 //! orthogonal projection points.
70 //! Note: if this algorithm fails, NbPoints returns 0.
71 Standard_EXPORT Standard_Integer NbPoints() const;
72 Standard_EXPORT operator Standard_Integer() const;
74 //! Returns the orthogonal projection
75 //! on the curve. Index is a number of a computed point.
77 //! Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where
78 //! NbPoints is the number of solution points.
79 Standard_EXPORT gp_Pnt Point (const Standard_Integer Index) const;
81 //! Returns the parameter on the curve
82 //! of the point, which is the orthogonal projection. Index is a
83 //! number of a computed point.
85 //! Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where
86 //! NbPoints is the number of solution points.
87 Standard_EXPORT Standard_Real Parameter (const Standard_Integer Index) const;
89 //! Returns the parameter on the curve
90 //! of the point, which is the orthogonal projection. Index is a
91 //! number of a computed point.
93 //! Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where
94 //! NbPoints is the number of solution points.-
95 Standard_EXPORT void Parameter (const Standard_Integer Index, Standard_Real& U) const;
97 //! Computes the distance between the
98 //! point and its orthogonal projection on the curve. Index is a number of a computed point.
100 //! Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where
101 //! NbPoints is the number of solution points.
102 Standard_EXPORT Standard_Real Distance (const Standard_Integer Index) const;
104 //! Returns the nearest orthogonal
105 //! projection of the point on the curve.
106 //! Exceptions: StdFail_NotDone if this algorithm fails.
107 Standard_EXPORT gp_Pnt NearestPoint() const;
108 Standard_EXPORT operator gp_Pnt() const;
110 //! Returns the parameter on the curve
111 //! of the nearest orthogonal projection of the point.
112 //! Exceptions: StdFail_NotDone if this algorithm fails.
113 Standard_EXPORT Standard_Real LowerDistanceParameter() const;
115 //! Computes the distance between the
116 //! point and its nearest orthogonal projection on the curve.
117 //! Exceptions: StdFail_NotDone if this algorithm fails.
118 Standard_EXPORT Standard_Real LowerDistance() const;
119 Standard_EXPORT operator Standard_Real() const;
121 //! return the algorithmic object from Extrema
122 const Extrema_ExtPC& Extrema() const;
126 Standard_Boolean myIsDone;
127 Standard_Integer myIndex;
128 Extrema_ExtPC myExtPC;
129 GeomAdaptor_Curve myC;
134 #include <GeomAPI_ProjectPointOnCurve.lxx>
140 #endif // _GeomAPI_ProjectPointOnCurve_HeaderFile