0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / Geom2dAPI / Geom2dAPI_ProjectPointOnCurve.hxx
1 // Created on: 1994-03-23
2 // Created by: Bruno DUMORTIER
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _Geom2dAPI_ProjectPointOnCurve_HeaderFile
18 #define _Geom2dAPI_ProjectPointOnCurve_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Standard_Integer.hxx>
25 #include <Extrema_ExtPC2d.hxx>
26 #include <Geom2dAdaptor_Curve.hxx>
27 class gp_Pnt2d;
28 class Geom2d_Curve;
29
30
31
32 //! This class implements methods for computing all the orthogonal
33 //! projections of a 2D point onto a 2D curve.
34 class Geom2dAPI_ProjectPointOnCurve 
35 {
36 public:
37
38   DEFINE_STANDARD_ALLOC
39
40   
41   //! Constructs an empty projector algorithm. Use an Init
42   //! function to define the point and the curve on which it is going to work.
43   Standard_EXPORT Geom2dAPI_ProjectPointOnCurve();
44   
45   //! Create the projection  of a  point  <P> on a curve
46   //! <Curve>
47   Standard_EXPORT Geom2dAPI_ProjectPointOnCurve(const gp_Pnt2d& P, const Handle(Geom2d_Curve)& Curve);
48   
49   //! Create  the projection  of a point <P>  on a curve
50   //! <Curve> limited by the two   points of parameter Umin and Usup.
51   //! Warning
52   //! Use the function NbPoints to obtain the number of solutions. If
53   //! projection fails, NbPoints returns 0.
54   Standard_EXPORT Geom2dAPI_ProjectPointOnCurve(const gp_Pnt2d& P, const Handle(Geom2d_Curve)& Curve, const Standard_Real Umin, const Standard_Real Usup);
55   
56   //! Initializes this algorithm with the given arguments, and
57   //! computes the orthogonal  projections  of a  point  <P> on a curve <Curve>
58   Standard_EXPORT void Init (const gp_Pnt2d& P, const Handle(Geom2d_Curve)& Curve);
59   
60   //! Initializes this algorithm with the given arguments, and
61   //! computes the orthogonal projections of the point P onto the portion
62   //! of the curve Curve limited by the two points of parameter Umin and Usup.
63   Standard_EXPORT void Init (const gp_Pnt2d& P, const Handle(Geom2d_Curve)& Curve, const Standard_Real Umin, const Standard_Real Usup);
64   
65   //! return the number of of computed
66   //! orthogonal projectionn points.
67   Standard_EXPORT Standard_Integer NbPoints() const;
68 Standard_EXPORT operator Standard_Integer() const;
69   
70   //! Returns the orthogonal projection
71   //! on the curve. Index is a number of a computed point.
72   //! Exceptions
73   //! Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where
74   //! NbPoints is the number of solution points.
75   Standard_EXPORT gp_Pnt2d Point (const Standard_Integer Index) const;
76   
77   //! Returns the parameter on the curve
78   //! of a point which is the orthogonal projection. Index is a number of a
79   //! computed projected point.
80   //! Exceptions
81   //! Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where
82   //! NbPoints is the number of solution points.
83   Standard_EXPORT Standard_Real Parameter (const Standard_Integer Index) const;
84   
85   //! Returns the parameter on the curve
86   //! of a point which is the orthogonal projection. Index is a number of a
87   //! computed projected point.
88   //! Exceptions
89   //! Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where
90   //! NbPoints is the number of solution points
91   Standard_EXPORT void Parameter (const Standard_Integer Index, Standard_Real& U) const;
92   
93   //! Computes the distance between the
94   //! point and its computed orthogonal projection on the curve. Index is a
95   //! number of computed projected point.
96   //! Exceptions
97   //! Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where
98   //! NbPoints is the number of solution points.
99   Standard_EXPORT Standard_Real Distance (const Standard_Integer Index) const;
100   
101   //! Returns the nearest orthogonal projection of the point on the curve.
102   //! Exceptions
103   //! StdFail_NotDone if this algorithm fails.
104   Standard_EXPORT gp_Pnt2d NearestPoint() const;
105 Standard_EXPORT operator gp_Pnt2d() const;
106   
107   //! Returns the parameter on the curve
108   //! of the nearest orthogonal projection of the point.
109   //! Exceptions
110   //! StdFail_NotDone if this algorithm fails.
111   Standard_EXPORT Standard_Real LowerDistanceParameter() const;
112   
113   //! Computes the distance between the
114   //! point and its nearest orthogonal projection on the curve.
115   //! Exceptions
116   //! StdFail_NotDone if this algorithm fails.
117   Standard_EXPORT Standard_Real LowerDistance() const;
118 Standard_EXPORT operator Standard_Real() const;
119   
120   //! return the algorithmic object from Extrema
121     const Extrema_ExtPC2d& Extrema() const;
122
123 private:
124
125   Standard_Boolean myIsDone;
126   Standard_Integer myIndex;
127   Extrema_ExtPC2d myExtPC;
128   Geom2dAdaptor_Curve myC;
129
130
131 };
132
133
134 #include <Geom2dAPI_ProjectPointOnCurve.lxx>
135
136
137
138
139
140 #endif // _Geom2dAPI_ProjectPointOnCurve_HeaderFile