b311480e |
1 | -- Created on: 1994-03-23 |
2 | -- Created by: Bruno DUMORTIER |
3 | -- Copyright (c) 1994-1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | class ProjectPointOnCurve from Geom2dAPI |
18 | ---Purpose: |
19 | -- This class implements methods for computing all the orthogonal |
20 | -- projections of a 2D point onto a 2D curve. |
21 | |
22 | uses |
23 | Curve from Geom2d, |
24 | Curve from Geom2dAdaptor, |
25 | ExtPC2d from Extrema, |
26 | Pnt2d from gp, |
27 | Length from Quantity, |
28 | Parameter from Quantity |
29 | |
30 | raises |
31 | OutOfRange from Standard, |
32 | NotDone from StdFail |
33 | |
34 | |
35 | is |
36 | Create |
37 | ---Purpose: Constructs an empty projector algorithm. Use an Init |
38 | -- function to define the point and the curve on which it is going to work. |
39 | returns ProjectPointOnCurve from Geom2dAPI; |
40 | |
41 | |
42 | Create(P : Pnt2d from gp; |
43 | Curve : Curve from Geom2d) |
44 | ---Purpose: Create the projection of a point <P> on a curve |
45 | -- <Curve> |
46 | ---Level: Public |
47 | returns ProjectPointOnCurve from Geom2dAPI; |
48 | |
49 | |
50 | Create(P : Pnt2d from gp; |
51 | Curve : Curve from Geom2d; |
52 | Umin, Usup : Parameter from Quantity) |
53 | ---Purpose: Create the projection of a point <P> on a curve |
54 | -- <Curve> limited by the two points of parameter Umin and Usup. |
55 | -- Warning |
56 | -- Use the function NbPoints to obtain the number of solutions. If |
57 | -- projection fails, NbPoints returns 0. |
58 | returns ProjectPointOnCurve from Geom2dAPI; |
59 | |
60 | |
61 | Init(me : in out; |
62 | P : Pnt2d from gp; |
63 | Curve : Curve from Geom2d) |
64 | ---Purpose: Initializes this algorithm with the given arguments, and |
65 | -- computes the orthogonal projections of a point <P> on a curve <Curve> |
66 | is static; |
67 | |
68 | |
69 | Init(me : in out; |
70 | P : Pnt2d from gp; |
71 | Curve : Curve from Geom2d; |
72 | Umin, Usup : Parameter from Quantity) |
73 | ---Purpose: Initializes this algorithm with the given arguments, and |
74 | -- computes the orthogonal projections of the point P onto the portion |
75 | -- of the curve Curve limited by the two points of parameter Umin and Usup. |
76 | is static; |
77 | |
78 | |
79 | NbPoints(me) |
80 | ---Purpose: return the number of of computed |
81 | -- orthogonal projectionn points. |
82 | returns Integer from Standard |
83 | ---C++: alias "Standard_EXPORT operator Standard_Integer() const;" |
84 | is static; |
85 | |
86 | |
87 | Point(me; Index : Integer from Standard) |
88 | returns Pnt2d from gp |
89 | ---Purpose: Returns the orthogonal projection |
90 | -- on the curve. Index is a number of a computed point. |
91 | -- Exceptions |
92 | -- Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where |
93 | -- NbPoints is the number of solution points. |
94 | raises |
95 | OutOfRange from Standard |
96 | |
97 | is static; |
98 | |
99 | |
100 | Parameter(me; Index : Integer from Standard) |
101 | returns Parameter from Quantity |
102 | ---Purpose: Returns the parameter on the curve |
103 | -- of a point which is the orthogonal projection. Index is a number of a |
104 | -- computed projected point. |
105 | -- Exceptions |
106 | -- Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where |
107 | -- NbPoints is the number of solution points. |
108 | raises |
109 | OutOfRange from Standard |
110 | |
111 | is static; |
112 | |
113 | |
114 | Parameter(me; Index : Integer from Standard; |
115 | U : out Parameter from Quantity) |
116 | ---Purpose: Returns the parameter on the curve |
117 | -- of a point which is the orthogonal projection. Index is a number of a |
118 | -- computed projected point. |
119 | -- Exceptions |
120 | -- Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where |
121 | -- NbPoints is the number of solution points |
122 | raises |
123 | OutOfRange from Standard |
124 | |
125 | is static; |
126 | |
127 | Distance(me; Index : Integer from Standard) |
128 | returns Length from Quantity |
129 | ---Purpose: Computes the distance between the |
130 | -- point and its computed orthogonal projection on the curve. Index is a |
131 | -- number of computed projected point. |
132 | -- Exceptions |
133 | -- Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where |
134 | -- NbPoints is the number of solution points. |
135 | raises |
136 | OutOfRange from Standard |
137 | |
138 | is static; |
139 | |
140 | |
141 | NearestPoint(me) |
142 | returns Pnt2d from gp |
143 | ---Purpose: Returns the nearest orthogonal projection of the point on the curve. |
144 | -- Exceptions |
145 | -- StdFail_NotDone if this algorithm fails. |
146 | ---C++: alias "Standard_EXPORT operator gp_Pnt2d() const;" |
147 | raises |
148 | NotDone from StdFail |
149 | is static; |
150 | |
151 | |
152 | LowerDistanceParameter(me) |
153 | returns Parameter from Quantity |
154 | ---Purpose: Returns the parameter on the curve |
155 | -- of the nearest orthogonal projection of the point. |
156 | -- Exceptions |
157 | -- StdFail_NotDone if this algorithm fails. |
158 | raises |
159 | NotDone from StdFail |
160 | is static; |
161 | |
162 | |
163 | LowerDistance(me) |
164 | ---Purpose: Computes the distance between the |
165 | -- point and its nearest orthogonal projection on the curve. |
166 | -- Exceptions |
167 | -- StdFail_NotDone if this algorithm fails. |
168 | returns Length from Quantity |
169 | ---C++: alias "Standard_EXPORT operator Standard_Real() const;" |
170 | raises |
171 | NotDone from StdFail |
172 | is static; |
173 | |
174 | |
175 | Extrema(me) |
176 | ---Purpose: return the algorithmic object from Extrema |
177 | ---Level: Advanced |
178 | ---C++: return const& |
179 | ---C++: inline |
180 | returns ExtPC2d from Extrema |
181 | is static; |
182 | |
183 | |
184 | fields |
185 | |
186 | myIsDone: Boolean from Standard; |
187 | myIndex : Integer from Standard; -- index of the nearest solution |
188 | myExtPC : ExtPC2d from Extrema; |
189 | myC : Curve from Geom2dAdaptor; |
190 | |
191 | end ProjectPointOnCurve; |