b311480e |
1 | -- Created on: 1994-03-18 |
2 | -- Created by: Bruno DUMORTIER |
3 | -- Copyright (c) 1994-1999 Matra Datavision |
4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | -- |
6 | -- The content of this file is subject to the Open CASCADE Technology Public |
7 | -- License Version 6.5 (the "License"). You may not use the content of this file |
8 | -- except in compliance with the License. Please obtain a copy of the License |
9 | -- at http://www.opencascade.org and read it completely before using this file. |
10 | -- |
11 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | -- |
14 | -- The Original Code and all software distributed under the License is |
15 | -- distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | -- Initial Developer hereby disclaims all such warranties, including without |
17 | -- limitation, any warranties of merchantability, fitness for a particular |
18 | -- purpose or non-infringement. Please see the License for the specific terms |
19 | -- and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | |
23 | |
24 | class ExtremaCurveSurface from GeomAPI |
25 | |
26 | ---Purpose: Describes functions for computing all the extrema |
27 | -- between a curve and a surface. |
28 | -- An ExtremaCurveSurface algorithm minimizes or |
29 | -- maximizes the distance between a point on the curve |
30 | -- and a point on the surface. Thus, it computes start |
31 | -- and end points of perpendiculars common to the |
32 | -- curve and the surface (an intersection point is not an |
33 | -- extremum except where the curve and the surface |
34 | -- are tangential at this point). |
35 | -- Solutions consist of pairs of points, and an extremum |
36 | -- is considered to be a segment joining the two points of a solution. |
37 | -- An ExtremaCurveSurface object provides a framework for: |
38 | -- - defining the construction of the extrema, |
39 | -- - implementing the construction algorithm, and |
40 | -- - consulting the results. |
41 | -- Warning |
42 | -- In some cases, the nearest points between a curve |
43 | -- and a surface do not correspond to one of the |
44 | -- computed extrema. Instead, they may be given by: |
45 | -- - a point of a bounding curve of the surface and one of the following: |
46 | -- - its orthogonal projection on the curve, |
47 | -- - a limit point of the curve; or |
48 | -- - a limit point of the curve and its projection on the surface; or |
49 | -- - an intersection point between the curve and the surface. |
50 | |
51 | uses |
52 | Curve from Geom, |
53 | Surface from Geom, |
54 | ExtCS from Extrema, |
55 | Pnt from gp, |
56 | Length from Quantity, |
57 | Parameter from Quantity |
58 | |
59 | |
60 | raises |
61 | OutOfRange from Standard, |
62 | NotDone from StdFail |
63 | |
64 | |
65 | is |
66 | |
67 | Create |
68 | ---Purpose: Constructs an empty algorithm for computing |
69 | -- extrema between a curve and a surface. Use an |
70 | -- Init function to define the curve and the surface on |
71 | -- which it is going to work. |
72 | returns ExtremaCurveSurface from GeomAPI; |
73 | |
74 | |
75 | Create(Curve : Curve from Geom; |
76 | Surface : Surface from Geom) |
77 | ---Purpose: Computes the extrema distances between the |
78 | -- curve <C> and the surface <S>. |
79 | ---Level: Public |
80 | returns ExtremaCurveSurface from GeomAPI; |
81 | |
82 | |
83 | Create(Curve : Curve from Geom; |
84 | Surface : Surface from Geom; |
85 | Wmin, Wmax : Parameter from Quantity; |
86 | Umin, Umax : Parameter from Quantity; |
87 | Vmin, Vmax : Parameter from Quantity) |
88 | ---Purpose: Computes the extrema distances between the |
89 | -- curve <C> and the surface <S>. The solution |
90 | -- point are computed in the domain [Wmin,Wmax] of |
91 | -- the curve and in the domain [Umin,Umax] |
92 | -- [Vmin,Vmax] of the surface. |
93 | -- Warning |
94 | -- Use the function NbExtrema to obtain the number |
95 | -- of solutions. If this algorithm fails, NbExtrema returns 0. |
96 | returns ExtremaCurveSurface from GeomAPI; |
97 | |
98 | |
99 | Init(me : in out; |
100 | Curve : Curve from Geom; |
101 | Surface : Surface from Geom) |
102 | ---Purpose: Computes the extrema distances between the |
103 | -- curve <C> and the surface <S>. |
104 | ---Level: Public |
105 | is static; |
106 | |
107 | |
108 | Init(me : in out; |
109 | Curve : Curve from Geom; |
110 | Surface : Surface from Geom; |
111 | Wmin, Wmax : Parameter from Quantity; |
112 | Umin, Umax : Parameter from Quantity; |
113 | Vmin, Vmax : Parameter from Quantity) |
114 | ---Purpose: Computes the extrema distances between the |
115 | -- curve <C> and the surface <S>. The solution |
116 | -- point are computed in the domain [Wmin,Wmax] of |
117 | -- the curve and in the domain [Umin,Umax] |
118 | -- [Vmin,Vmax] of the surface. |
119 | -- Warning |
120 | -- Use the function NbExtrema to obtain the number |
121 | -- of solutions. If this algorithm fails, NbExtrema returns 0. |
122 | is static; |
123 | |
124 | |
125 | NbExtrema(me) |
126 | ---Purpose: Returns the number of extrema computed by this algorithm. |
127 | -- Note: if this algorithm fails, NbExtrema returns 0. |
128 | returns Integer from Standard |
129 | ---C++: alias "Standard_EXPORT operator Standard_Integer() const;" |
130 | is static; |
131 | |
132 | |
133 | Points(me; Index : Integer from Standard; |
134 | P1, P2 : out Pnt from gp ) |
135 | ---Purpose: Returns the points P1 on the curve and P2 on the |
136 | -- surface, which are the ends of the extremum of index |
137 | -- Index computed by this algorithm. |
138 | -- Exceptions |
139 | -- Standard_OutOfRange if Index is not in the range [ |
140 | -- 1,NbExtrema ], where NbExtrema is the |
141 | -- number of extrema computed by this algorithm. |
142 | raises |
143 | OutOfRange from Standard |
144 | is static; |
145 | |
146 | |
147 | Parameters(me; Index : Integer from Standard; |
148 | W : out Parameter from Quantity; |
149 | U, V : out Parameter from Quantity) |
150 | ---Purpose: Returns the parameters W of the point on the curve, |
151 | -- and (U,V) of the point on the surface, which are the |
152 | -- ends of the extremum of index Index computed by this algorithm. |
153 | -- Exceptions |
154 | -- Standard_OutOfRange if Index is not in the range [ |
155 | -- 1,NbExtrema ], where NbExtrema is the |
156 | -- number of extrema computed by this algorithm. |
157 | raises |
158 | OutOfRange from Standard |
159 | is static; |
160 | |
161 | |
162 | Distance(me; Index : Integer from Standard) |
163 | returns Length from Quantity |
164 | ---Purpose: Computes the distance between the end points of the |
165 | -- extremum of index Index computed by this algorithm. |
166 | -- Exceptions |
167 | -- Standard_OutOfRange if index is not in the range [ |
168 | -- 1,NbExtrema ], where NbExtrema is the |
169 | -- number of extrema computed by this algorithm. |
170 | raises |
171 | OutOfRange from Standard |
172 | is static; |
173 | |
174 | |
175 | NearestPoints(me; PC, PS : out Pnt from gp) |
176 | ---Purpose: Returns the points PC on the curve and PS on the |
177 | -- surface, which are the ends of the shortest extremum computed by this algorithm. |
178 | -- Exceptions - StdFail_NotDone if this algorithm fails. |
179 | raises |
180 | NotDone from StdFail |
181 | is static; |
182 | |
183 | |
184 | LowerDistanceParameters(me; W : out Parameter from Quantity; |
185 | U, V : out Parameter from Quantity) |
186 | ---Purpose: Returns the parameters W of the point on the curve |
187 | -- and (U,V) of the point on the surface, which are the |
188 | -- ends of the shortest extremum computed by this algorithm. |
189 | -- Exceptions - StdFail_NotDone if this algorithm fails. |
190 | raises |
191 | NotDone from StdFail |
192 | is static; |
193 | |
194 | |
195 | LowerDistance(me) |
196 | ---Purpose: Computes the distance between the end points of the |
197 | -- shortest extremum computed by this algorithm. |
198 | -- Exceptions - StdFail_NotDone if this algorithm fails. |
199 | returns Length from Quantity |
200 | ---C++: alias "Standard_EXPORT operator Standard_Real() const;" |
201 | raises |
202 | NotDone from StdFail |
203 | is static; |
204 | |
205 | |
206 | Extrema(me) |
207 | ---Purpose: Returns the algorithmic object from Extrema |
208 | ---Level: Advanced |
209 | ---C++: return const& |
210 | ---C++: inline |
211 | returns ExtCS from Extrema |
212 | is static; |
213 | |
214 | |
215 | fields |
216 | |
217 | myIsDone: Boolean from Standard; |
218 | myIndex : Integer from Standard; -- index of the nearest solution |
219 | myExtCS : ExtCS from Extrema; |
220 | |
221 | |
222 | end ExtremaCurveSurface; |