b311480e |
1 | -- Created on: 1991-09-09 |
2 | -- Created by: Michel Chauvat |
3 | -- Copyright (c) 1991-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 | -- |
973c2be1 |
8 | -- This library is free software; you can redistribute it and / or modify it |
9 | -- under the terms of the GNU Lesser General Public 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. |
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 | package ElSLib |
18 | |
19 | --- Purpose : Provides functions for basic geometric computation on |
20 | -- elementary surfaces. |
21 | -- This includes: |
22 | -- - calculation of a point or derived vector on a surface |
23 | -- where the surface is provided by the gp package, or |
24 | -- defined in canonical form (as in the gp package), and |
25 | -- the point is defined with a parameter, |
26 | -- - evaluation of the parameters corresponding to a |
27 | -- point on an elementary surface from gp, |
28 | -- - calculation of isoparametric curves on an elementary |
29 | -- surface defined in canonical form (as in the gp package). |
30 | -- Notes: |
31 | -- - ElSLib stands for Elementary Surfaces Library. |
32 | -- - If the surfaces provided by the gp package are not |
33 | -- explicitly parameterized, they still have an implicit |
34 | -- parameterization, similar to that which they infer on |
35 | -- the equivalent Geom surfaces. |
36 | -- Note: ElSLib stands for Elementary Surfaces Library. |
37 | |
38 | uses gp |
39 | |
40 | is |
41 | |
42 | Value (U, V : Real; Pl : Pln from gp) |
43 | returns Pnt from gp; |
44 | ---Purpose: For elementary surfaces from the gp package (planes, |
45 | -- cones, cylinders, spheres and tori), computes the point |
46 | -- of parameters (U, V). |
47 | |
48 | Value (U, V : Real; C : Cone from gp) |
49 | returns Pnt from gp; |
50 | ---C++: inline |
51 | |
52 | Value (U, V : Real; C : Cylinder from gp) |
53 | returns Pnt from gp; |
54 | ---C++: inline |
55 | |
56 | Value (U, V : Real; S : Sphere from gp) |
57 | returns Pnt from gp; |
58 | ---C++: inline |
59 | |
60 | Value (U,V : Real; T : Torus from gp) |
61 | returns Pnt from gp; |
62 | ---C++: inline |
63 | |
64 | DN (U, V : Real; Pl : Pln from gp; Nu, Nv : Integer) |
65 | returns Vec from gp; |
66 | ---Purpose: For elementary surfaces from the gp package (planes, |
67 | -- cones, cylinders, spheres and tori), computes the |
68 | -- derivative vector of order Nu and Nv in the u and v |
69 | -- parametric directions respectively, at the point of |
70 | -- parameters (U, V). |
71 | |
72 | DN (U, V : Real; C : Cone from gp; Nu, Nv : Integer) |
73 | returns Vec from gp; |
74 | ---C++: inline |
75 | |
76 | DN (U, V : Real; C : Cylinder from gp; Nu, Nv : Integer) |
77 | returns Vec from gp; |
78 | ---C++: inline |
79 | |
80 | DN (U, V : Real; S : Sphere from gp; Nu, Nv : Integer) |
81 | returns Vec from gp; |
82 | ---C++: inline |
83 | |
84 | DN (U, V : Real; T : Torus from gp; Nu, Nv : Integer) |
85 | returns Vec from gp; |
86 | ---C++: inline |
87 | |
88 | D0 (U, V : Real; Pl : Pln from gp; P : out Pnt from gp); |
89 | ---Purpose: For elementary surfaces from the gp package (planes, |
90 | -- cones, cylinders, spheres and tori), computes the point P |
91 | -- of parameters (U, V).inline |
92 | |
93 | D0 (U, V : Real; C : Cone from gp; P : out Pnt from gp); |
94 | ---C++: inline |
95 | |
96 | D0 (U, V : Real; C : Cylinder from gp; P : out Pnt from gp); |
97 | ---C++: inline |
98 | |
99 | D0 (U, V : Real; S : Sphere from gp; P : out Pnt from gp); |
100 | ---C++: inline |
101 | |
102 | D0 (U, V : Real; T : Torus from gp; P : out Pnt from gp); |
103 | ---C++: inline |
104 | |
105 | D1 (U, V : Real; Pl : Pln from gp; P : out Pnt from gp; |
106 | Vu, Vv : out Vec from gp); |
107 | ---Purpose: |
108 | -- For elementary surfaces from the gp package (planes, |
109 | -- cones, cylinders, spheres and tori), computes: |
110 | -- - the point P of parameters (U, V), and |
111 | -- - the first derivative vectors Vu and Vv at this point in |
112 | -- the u and v parametric directions respectively. |
113 | |
114 | D1 (U, V : Real; C : Cone from gp; P : out Pnt from gp; |
115 | Vu, Vv : out Vec from gp); |
116 | ---C++: inline |
117 | |
118 | D1 (U, V : Real; C : Cylinder from gp; P : out Pnt from gp; |
119 | Vu, Vv : out Vec from gp); |
120 | ---C++: inline |
121 | |
122 | D1 (U, V : Real; S : Sphere from gp; P : out Pnt from gp; |
123 | Vu, Vv : out Vec from gp); |
124 | ---C++: inline |
125 | |
126 | D1 (U, V : Real; T : Torus from gp; P : out Pnt from gp; |
127 | Vu, Vv : out Vec from gp); |
128 | ---C++: inline |
129 | |
130 | D2 (U, V : Real; C : Cone from gp; P : out Pnt from gp; |
131 | Vu, Vv, Vuu, Vvv, Vuv : out Vec from gp); |
132 | ---Purpose: |
133 | -- For elementary surfaces from the gp package (cones, |
134 | -- cylinders, spheres and tori), computes: |
135 | -- - the point P of parameters (U, V), and |
136 | -- - the first derivative vectors Vu and Vv at this point in |
137 | -- the u and v parametric directions respectively, and |
138 | -- - the second derivative vectors Vuu, Vvv and Vuv at this point. |
139 | |
140 | D2 (U, V : Real; C : Cylinder from gp; P : out Pnt from gp; |
141 | Vu,Vv,Vuu,Vvv,Vuv : out Vec from gp); |
142 | ---C++: inline |
143 | |
144 | D2 (U, V : Real; S : Sphere from gp; P : out Pnt from gp; |
145 | Vu, Vv, Vuu, Vvv, Vuv : out Vec from gp); |
146 | ---C++: inline |
147 | |
148 | D2 (U, V : Real; T : Torus from gp; P : out Pnt from gp; |
149 | Vu, Vv, Vuu, Vvv, Vuv : out Vec from gp); |
150 | ---C++: inline |
151 | |
152 | D3 (U, V : Real; C : Cone from gp; P : out Pnt from gp; |
153 | Vu, Vv, Vuu, Vvv, Vuv, Vuuu, Vvvv, Vuuv, Vuvv : out Vec from gp); |
154 | ---Purpose: |
155 | -- For elementary surfaces from the gp package (cones, |
156 | -- cylinders, spheres and tori), computes: |
157 | -- - the point P of parameters (U,V), and |
158 | -- - the first derivative vectors Vu and Vv at this point in |
159 | -- the u and v parametric directions respectively, and |
160 | -- - the second derivative vectors Vuu, Vvv and Vuv at |
161 | -- this point, and |
162 | -- - the third derivative vectors Vuuu, Vvvv, Vuuv and |
163 | -- Vuvv at this point. |
164 | |
165 | D3 (U, V : Real; C : Cylinder from gp; P : out Pnt from gp; |
166 | Vu, Vv, Vuu, Vvv, Vuv, Vuuu, Vvvv, Vuuv, Vuvv : out Vec from gp); |
167 | ---C++: inline |
168 | |
169 | D3 (U, V : Real; S : Sphere from gp; P : out Pnt from gp; |
170 | Vu, Vv, Vuu, Vvv, Vuv, Vuuu, Vvvv, Vuuv, Vuvv : out Vec from gp); |
171 | ---C++: inline |
172 | |
173 | D3 (U, V : Real; T : Torus from gp; P : out Pnt from gp; |
174 | Vu, Vv, Vuu, Vvv, Vuv, Vuuu, Vvvv, Vuuv, Vuvv : out Vec from gp); |
175 | ---C++: inline |
176 | |
177 | |
178 | |
179 | --- Purpose : Surface evaluation |
180 | -- The following functions compute the point and the |
181 | -- derivatives on elementary surfaces defined with their |
182 | -- geometric characterisitics. |
183 | -- You don't need to create the surface to use these functions. |
184 | -- These functions are called by the previous ones. |
185 | --- Example : |
186 | -- A cylinder is defined with its position and its radius. |
187 | |
188 | |
189 | |
190 | PlaneValue (U, V : Real; Pos : Ax3 from gp) |
191 | returns Pnt from gp; |
192 | |
193 | CylinderValue (U, V : Real; Pos : Ax3 from gp; Radius : Real) |
194 | returns Pnt from gp; |
195 | |
196 | ConeValue (U, V : Real; Pos : Ax3 from gp; Radius, SAngle : Real) |
197 | returns Pnt from gp; |
198 | |
199 | SphereValue (U, V : Real; Pos : Ax3 from gp; Radius : Real) |
200 | returns Pnt from gp; |
201 | |
202 | TorusValue (U, V : Real; Pos : Ax3 from gp; MajorRadius, MinorRadius : Real) |
203 | returns Pnt from gp; |
204 | |
205 | PlaneDN (U, V : Real; Pos : Ax3 from gp; Nu, Nv : Integer) |
206 | returns Vec from gp; |
207 | |
208 | CylinderDN (U, V : Real; Pos: Ax3 from gp; Radius : Real; Nu, Nv : Integer) |
209 | returns Vec from gp; |
210 | |
211 | ConeDN (U, V : Real; Pos : Ax3 from gp; Radius, SAngle : Real; |
212 | Nu, Nv : Integer) |
213 | returns Vec from gp; |
214 | |
215 | SphereDN (U, V : Real; Pos: Ax3 from gp; Radius : Real; Nu, Nv : Integer) |
216 | returns Vec from gp; |
217 | |
218 | TorusDN (U, V : Real; Pos: Ax3 from gp; MajorRadius, MinorRadius : Real; |
219 | Nu, Nv : Integer) |
220 | returns Vec from gp; |
221 | |
222 | PlaneD0 (U, V : Real; Pos : Ax3 from gp; P : out Pnt from gp); |
223 | |
224 | ConeD0 (U, V : Real; Pos : Ax3 from gp; Radius, SAngle : Real; |
225 | P : out Pnt from gp); |
226 | |
227 | CylinderD0 (U, V : Real; Pos : Ax3 from gp; Radius : Real; |
228 | P : out Pnt from gp); |
229 | |
230 | SphereD0 (U, V : Real; Pos : Ax3 from gp; Radius : Real; |
231 | P : out Pnt from gp); |
232 | |
233 | TorusD0 (U, V : Real; Pos : Ax3 from gp; MajorRadius, MinorRadius : Real; |
234 | P : out Pnt from gp); |
235 | |
236 | PlaneD1 (U, V : Real; Pos : Ax3 from gp; P : out Pnt from gp; |
237 | Vu, Vv : out Vec from gp); |
238 | |
239 | ConeD1 (U, V : Real; Pos : Ax3 from gp; Radius, SAngle : Real; |
240 | P : out Pnt from gp; Vu, Vv : out Vec from gp); |
241 | |
242 | CylinderD1 (U, V : Real; Pos : Ax3 from gp; Radius : Real; |
243 | P : out Pnt from gp; Vu, Vv : out Vec from gp); |
244 | |
245 | SphereD1 (U, V : Real; Pos : Ax3 from gp; Radius : Real; |
246 | P : out Pnt from gp; Vu, Vv : out Vec from gp); |
247 | |
248 | TorusD1 (U, V : Real; Pos : Ax3 from gp; MajorRadius, MinorRadius : Real; |
249 | P : out Pnt from gp; Vu, Vv : out Vec from gp); |
250 | |
251 | ConeD2 (U, V : Real; Pos : Ax3 from gp; Radius, SAngle : Real; |
252 | P : out Pnt from gp; Vu, Vv, Vuu, Vvv, Vuv : out Vec from gp); |
253 | |
254 | CylinderD2 (U, V : Real; Pos : Ax3 from gp; Radius : Real; |
255 | P : out Pnt from gp; Vu,Vv,Vuu,Vvv,Vuv : out Vec from gp); |
256 | |
257 | SphereD2 (U, V : Real; Pos : Ax3 from gp; Radius : Real; |
258 | P : out Pnt from gp; Vu, Vv, Vuu, Vvv, Vuv : out Vec from gp); |
259 | |
260 | TorusD2 (U, V : Real; Pos : Ax3 from gp; MajorRadius, MinorRadius : Real; |
261 | P : out Pnt from gp; Vu, Vv, Vuu, Vvv, Vuv : out Vec from gp); |
262 | |
263 | ConeD3 (U, V : Real; Pos : Ax3 from gp; Radius, SAngle : Real; |
264 | P : out Pnt from gp; |
265 | Vu, Vv, Vuu, Vvv, Vuv, Vuuu, Vvvv, Vuuv, Vuvv : out Vec from gp); |
266 | |
267 | CylinderD3 (U, V : Real; Pos : Ax3 from gp; Radius : Real; |
268 | P : out Pnt from gp; |
269 | Vu, Vv, Vuu, Vvv, Vuv, Vuuu, Vvvv, Vuuv, Vuvv : out Vec from gp); |
270 | |
271 | SphereD3 (U, V : Real; Pos : Ax3 from gp; Radius : Real; P : out Pnt from gp; |
272 | Vu, Vv, Vuu, Vvv, Vuv, Vuuu, Vvvv, Vuuv, Vuvv : out Vec from gp); |
273 | |
274 | TorusD3 (U, V : Real; Pos : Ax3 from gp; MajorRadius, MinorRadius : Real; |
275 | P : out Pnt from gp; |
276 | Vu, Vv, Vuu, Vvv, Vuv, Vuuu, Vvvv, Vuuv, Vuvv : out Vec from gp); |
277 | |
278 | |
279 | |
280 | --- Purpose : |
281 | -- The following functions compute the parametric values |
282 | -- corresponding to a given point on a elementary surface. |
283 | -- The point should be on the surface. |
284 | |
285 | |
286 | Parameters (Pl : Pln from gp; P : Pnt from gp; U, V : out Real); |
287 | --- Purpose : parametrization |
288 | -- P (U, V) = |
289 | -- Pl.Location() + U * Pl.XDirection() + V * Pl.YDirection() |
290 | ---C++: inline |
291 | |
292 | |
293 | Parameters (C : Cylinder from gp; P : Pnt from gp; U, V : out Real); |
294 | --- Purpose : parametrization |
295 | -- P (U, V) = Location + V * ZDirection + |
296 | -- Radius * (Cos(U) * XDirection + Sin (U) * YDirection) |
297 | ---C++: inline |
298 | |
299 | |
300 | Parameters (C : Cone from gp; P : Pnt from gp; U, V : out Real); |
301 | --- Purpose : parametrization |
302 | -- P (U, V) = Location + V * ZDirection + |
303 | -- (Radius + V * Tan (SemiAngle)) * |
304 | -- (Cos(U) * XDirection + Sin(U) * YDirection) |
305 | ---C++: inline |
306 | |
307 | |
308 | Parameters (S : Sphere from gp; P : Pnt from gp; U, V : out Real); |
309 | --- Purpose : parametrization |
310 | -- P (U, V) = Location + |
311 | -- Radius * Cos (V) * (Cos (U) * XDirection + Sin (U) * YDirection) + |
312 | -- Radius * Sin (V) * ZDirection |
313 | ---C++: inline |
314 | |
315 | |
316 | Parameters (T : Torus from gp; P : Pnt from gp; U, V : out Real); |
317 | --- Purpose : parametrization |
318 | -- P (U, V) = Location + |
319 | -- (MajorRadius + MinorRadius * Cos(U)) * |
320 | -- (Cos(V) * XDirection - Sin(V) * YDirection) + |
321 | -- MinorRadius * Sin(U) * ZDirection |
322 | ---C++: inline |
323 | |
324 | |
325 | PlaneParameters (Pos: Ax3 from gp; P: Pnt from gp; U, V: out Real); |
326 | --- Purpose : parametrization |
327 | -- P (U, V) = |
328 | -- Pl.Location() + U * Pl.XDirection() + V * Pl.YDirection() |
329 | |
330 | |
331 | CylinderParameters (Pos: Ax3 from gp; Radius : Real; P: Pnt from gp; |
332 | U, V: out Real); |
333 | --- Purpose : parametrization |
334 | -- P (U, V) = Location + V * ZDirection + |
335 | -- Radius * (Cos(U) * XDirection + Sin (U) * YDirection) |
336 | |
337 | |
338 | ConeParameters (Pos: Ax3 from gp; Radius, SAngle: Real; P: Pnt from gp; |
339 | U, V: out Real); |
340 | --- Purpose : parametrization |
341 | -- P (U, V) = Location + V * ZDirection + |
342 | -- (Radius + V * Tan (SemiAngle)) * |
343 | -- (Cos(U) * XDirection + Sin(U) * YDirection) |
344 | |
345 | |
346 | SphereParameters (Pos: Ax3 from gp; Radius: Real; P: Pnt from gp; |
347 | U, V: out Real); |
348 | --- Purpose : parametrization |
349 | -- P (U, V) = Location + |
350 | -- Radius * Cos (V) * (Cos (U) * XDirection + Sin (U) * YDirection) + |
351 | -- Radius * Sin (V) * ZDirection |
352 | |
353 | |
354 | TorusParameters (Pos: Ax3 from gp; MajorRadius, MinorRadius: Real; |
355 | P : Pnt from gp; U, V : out Real); |
356 | --- Purpose : parametrization |
357 | -- P (U, V) = Location + |
358 | -- (MajorRadius + MinorRadius * Cos(U)) * |
359 | -- (Cos(V) * XDirection - Sin(V) * YDirection) + |
360 | -- MinorRadius * Sin(U) * ZDirection |
361 | |
362 | |
363 | PlaneUIso (Pos: Ax3 from gp; U : Real) |
364 | --- Purpose : compute the U Isoparametric gp_Lin of the plane. |
365 | returns Lin from gp; |
366 | |
367 | |
368 | CylinderUIso (Pos: Ax3 from gp; Radius, U : Real) |
369 | --- Purpose : compute the U Isoparametric gp_Lin of the cylinder. |
370 | returns Lin from gp; |
371 | |
372 | |
373 | ConeUIso (Pos: Ax3 from gp; Radius, SAngle, U: Real) |
374 | --- Purpose : compute the U Isoparametric gp_Lin of the cone. |
375 | returns Lin from gp; |
376 | |
377 | |
378 | SphereUIso (Pos: Ax3 from gp; Radius, U : Real) |
379 | --- Purpose : compute the U Isoparametric gp_Circ of the sphere, |
380 | -- (the meridian is not trimmed). |
381 | returns Circ from gp; |
382 | |
383 | |
384 | TorusUIso (Pos: Ax3 from gp; MajorRadius, MinorRadius, U: Real) |
385 | --- Purpose : compute the U Isoparametric gp_Circ of the torus. |
386 | returns Circ from gp; |
387 | |
388 | |
389 | PlaneVIso (Pos: Ax3 from gp; V : Real) |
390 | --- Purpose : compute the V Isoparametric gp_Lin of the plane. |
391 | returns Lin from gp; |
392 | |
393 | |
394 | CylinderVIso (Pos: Ax3 from gp; Radius, V : Real) |
395 | --- Purpose : compute the V Isoparametric gp_Circ of the cylinder. |
396 | returns Circ from gp; |
397 | |
398 | |
399 | ConeVIso (Pos: Ax3 from gp; Radius, SAngle, V : Real) |
400 | --- Purpose : compute the V Isoparametric gp_Circ of the cone. |
401 | returns Circ from gp; |
402 | |
403 | |
404 | SphereVIso (Pos: Ax3 from gp; Radius, V : Real) |
405 | --- Purpose : compute the V Isoparametric gp_Circ of the sphere, |
406 | -- (the meridian is not trimmed). |
407 | returns Circ from gp; |
408 | |
409 | |
410 | TorusVIso (Pos: Ax3 from gp; MajorRadius, MinorRadius, V : Real) |
411 | --- Purpose : compute the V Isoparametric gp_Circ of the torus. |
412 | returns Circ from gp; |
413 | |
414 | |
415 | end ElSLib; |
416 | |