1 -- Created on: 1991-09-09
2 -- Created by: Michel Chauvat
3 -- Copyright (c) 1991-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
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.
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.
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.
27 --- Purpose : Provides functions for basic geometric computation on
28 -- elementary surfaces.
30 -- - calculation of a point or derived vector on a surface
31 -- where the surface is provided by the gp package, or
32 -- defined in canonical form (as in the gp package), and
33 -- the point is defined with a parameter,
34 -- - evaluation of the parameters corresponding to a
35 -- point on an elementary surface from gp,
36 -- - calculation of isoparametric curves on an elementary
37 -- surface defined in canonical form (as in the gp package).
39 -- - ElSLib stands for Elementary Surfaces Library.
40 -- - If the surfaces provided by the gp package are not
41 -- explicitly parameterized, they still have an implicit
42 -- parameterization, similar to that which they infer on
43 -- the equivalent Geom surfaces.
44 -- Note: ElSLib stands for Elementary Surfaces Library.
50 Value (U, V : Real; Pl : Pln from gp)
52 ---Purpose: For elementary surfaces from the gp package (planes,
53 -- cones, cylinders, spheres and tori), computes the point
54 -- of parameters (U, V).
56 Value (U, V : Real; C : Cone from gp)
60 Value (U, V : Real; C : Cylinder from gp)
64 Value (U, V : Real; S : Sphere from gp)
68 Value (U,V : Real; T : Torus from gp)
72 DN (U, V : Real; Pl : Pln from gp; Nu, Nv : Integer)
74 ---Purpose: For elementary surfaces from the gp package (planes,
75 -- cones, cylinders, spheres and tori), computes the
76 -- derivative vector of order Nu and Nv in the u and v
77 -- parametric directions respectively, at the point of
80 DN (U, V : Real; C : Cone from gp; Nu, Nv : Integer)
84 DN (U, V : Real; C : Cylinder from gp; Nu, Nv : Integer)
88 DN (U, V : Real; S : Sphere from gp; Nu, Nv : Integer)
92 DN (U, V : Real; T : Torus from gp; Nu, Nv : Integer)
96 D0 (U, V : Real; Pl : Pln from gp; P : out Pnt from gp);
97 ---Purpose: For elementary surfaces from the gp package (planes,
98 -- cones, cylinders, spheres and tori), computes the point P
99 -- of parameters (U, V).inline
101 D0 (U, V : Real; C : Cone from gp; P : out Pnt from gp);
104 D0 (U, V : Real; C : Cylinder from gp; P : out Pnt from gp);
107 D0 (U, V : Real; S : Sphere from gp; P : out Pnt from gp);
110 D0 (U, V : Real; T : Torus from gp; P : out Pnt from gp);
113 D1 (U, V : Real; Pl : Pln from gp; P : out Pnt from gp;
114 Vu, Vv : out Vec from gp);
116 -- For elementary surfaces from the gp package (planes,
117 -- cones, cylinders, spheres and tori), computes:
118 -- - the point P of parameters (U, V), and
119 -- - the first derivative vectors Vu and Vv at this point in
120 -- the u and v parametric directions respectively.
122 D1 (U, V : Real; C : Cone from gp; P : out Pnt from gp;
123 Vu, Vv : out Vec from gp);
126 D1 (U, V : Real; C : Cylinder from gp; P : out Pnt from gp;
127 Vu, Vv : out Vec from gp);
130 D1 (U, V : Real; S : Sphere from gp; P : out Pnt from gp;
131 Vu, Vv : out Vec from gp);
134 D1 (U, V : Real; T : Torus from gp; P : out Pnt from gp;
135 Vu, Vv : out Vec from gp);
138 D2 (U, V : Real; C : Cone from gp; P : out Pnt from gp;
139 Vu, Vv, Vuu, Vvv, Vuv : out Vec from gp);
141 -- For elementary surfaces from the gp package (cones,
142 -- cylinders, spheres and tori), computes:
143 -- - the point P of parameters (U, V), and
144 -- - the first derivative vectors Vu and Vv at this point in
145 -- the u and v parametric directions respectively, and
146 -- - the second derivative vectors Vuu, Vvv and Vuv at this point.
148 D2 (U, V : Real; C : Cylinder from gp; P : out Pnt from gp;
149 Vu,Vv,Vuu,Vvv,Vuv : out Vec from gp);
152 D2 (U, V : Real; S : Sphere from gp; P : out Pnt from gp;
153 Vu, Vv, Vuu, Vvv, Vuv : out Vec from gp);
156 D2 (U, V : Real; T : Torus from gp; P : out Pnt from gp;
157 Vu, Vv, Vuu, Vvv, Vuv : out Vec from gp);
160 D3 (U, V : Real; C : Cone from gp; P : out Pnt from gp;
161 Vu, Vv, Vuu, Vvv, Vuv, Vuuu, Vvvv, Vuuv, Vuvv : out Vec from gp);
163 -- For elementary surfaces from the gp package (cones,
164 -- cylinders, spheres and tori), computes:
165 -- - the point P of parameters (U,V), and
166 -- - the first derivative vectors Vu and Vv at this point in
167 -- the u and v parametric directions respectively, and
168 -- - the second derivative vectors Vuu, Vvv and Vuv at
170 -- - the third derivative vectors Vuuu, Vvvv, Vuuv and
171 -- Vuvv at this point.
173 D3 (U, V : Real; C : Cylinder from gp; P : out Pnt from gp;
174 Vu, Vv, Vuu, Vvv, Vuv, Vuuu, Vvvv, Vuuv, Vuvv : out Vec from gp);
177 D3 (U, V : Real; S : Sphere from gp; P : out Pnt from gp;
178 Vu, Vv, Vuu, Vvv, Vuv, Vuuu, Vvvv, Vuuv, Vuvv : out Vec from gp);
181 D3 (U, V : Real; T : Torus from gp; P : out Pnt from gp;
182 Vu, Vv, Vuu, Vvv, Vuv, Vuuu, Vvvv, Vuuv, Vuvv : out Vec from gp);
187 --- Purpose : Surface evaluation
188 -- The following functions compute the point and the
189 -- derivatives on elementary surfaces defined with their
190 -- geometric characterisitics.
191 -- You don't need to create the surface to use these functions.
192 -- These functions are called by the previous ones.
194 -- A cylinder is defined with its position and its radius.
198 PlaneValue (U, V : Real; Pos : Ax3 from gp)
201 CylinderValue (U, V : Real; Pos : Ax3 from gp; Radius : Real)
204 ConeValue (U, V : Real; Pos : Ax3 from gp; Radius, SAngle : Real)
207 SphereValue (U, V : Real; Pos : Ax3 from gp; Radius : Real)
210 TorusValue (U, V : Real; Pos : Ax3 from gp; MajorRadius, MinorRadius : Real)
213 PlaneDN (U, V : Real; Pos : Ax3 from gp; Nu, Nv : Integer)
216 CylinderDN (U, V : Real; Pos: Ax3 from gp; Radius : Real; Nu, Nv : Integer)
219 ConeDN (U, V : Real; Pos : Ax3 from gp; Radius, SAngle : Real;
223 SphereDN (U, V : Real; Pos: Ax3 from gp; Radius : Real; Nu, Nv : Integer)
226 TorusDN (U, V : Real; Pos: Ax3 from gp; MajorRadius, MinorRadius : Real;
230 PlaneD0 (U, V : Real; Pos : Ax3 from gp; P : out Pnt from gp);
232 ConeD0 (U, V : Real; Pos : Ax3 from gp; Radius, SAngle : Real;
233 P : out Pnt from gp);
235 CylinderD0 (U, V : Real; Pos : Ax3 from gp; Radius : Real;
236 P : out Pnt from gp);
238 SphereD0 (U, V : Real; Pos : Ax3 from gp; Radius : Real;
239 P : out Pnt from gp);
241 TorusD0 (U, V : Real; Pos : Ax3 from gp; MajorRadius, MinorRadius : Real;
242 P : out Pnt from gp);
244 PlaneD1 (U, V : Real; Pos : Ax3 from gp; P : out Pnt from gp;
245 Vu, Vv : out Vec from gp);
247 ConeD1 (U, V : Real; Pos : Ax3 from gp; Radius, SAngle : Real;
248 P : out Pnt from gp; Vu, Vv : out Vec from gp);
250 CylinderD1 (U, V : Real; Pos : Ax3 from gp; Radius : Real;
251 P : out Pnt from gp; Vu, Vv : out Vec from gp);
253 SphereD1 (U, V : Real; Pos : Ax3 from gp; Radius : Real;
254 P : out Pnt from gp; Vu, Vv : out Vec from gp);
256 TorusD1 (U, V : Real; Pos : Ax3 from gp; MajorRadius, MinorRadius : Real;
257 P : out Pnt from gp; Vu, Vv : out Vec from gp);
259 ConeD2 (U, V : Real; Pos : Ax3 from gp; Radius, SAngle : Real;
260 P : out Pnt from gp; Vu, Vv, Vuu, Vvv, Vuv : out Vec from gp);
262 CylinderD2 (U, V : Real; Pos : Ax3 from gp; Radius : Real;
263 P : out Pnt from gp; Vu,Vv,Vuu,Vvv,Vuv : out Vec from gp);
265 SphereD2 (U, V : Real; Pos : Ax3 from gp; Radius : Real;
266 P : out Pnt from gp; Vu, Vv, Vuu, Vvv, Vuv : out Vec from gp);
268 TorusD2 (U, V : Real; Pos : Ax3 from gp; MajorRadius, MinorRadius : Real;
269 P : out Pnt from gp; Vu, Vv, Vuu, Vvv, Vuv : out Vec from gp);
271 ConeD3 (U, V : Real; Pos : Ax3 from gp; Radius, SAngle : Real;
273 Vu, Vv, Vuu, Vvv, Vuv, Vuuu, Vvvv, Vuuv, Vuvv : out Vec from gp);
275 CylinderD3 (U, V : Real; Pos : Ax3 from gp; Radius : Real;
277 Vu, Vv, Vuu, Vvv, Vuv, Vuuu, Vvvv, Vuuv, Vuvv : out Vec from gp);
279 SphereD3 (U, V : Real; Pos : Ax3 from gp; Radius : Real; P : out Pnt from gp;
280 Vu, Vv, Vuu, Vvv, Vuv, Vuuu, Vvvv, Vuuv, Vuvv : out Vec from gp);
282 TorusD3 (U, V : Real; Pos : Ax3 from gp; MajorRadius, MinorRadius : Real;
284 Vu, Vv, Vuu, Vvv, Vuv, Vuuu, Vvvv, Vuuv, Vuvv : out Vec from gp);
289 -- The following functions compute the parametric values
290 -- corresponding to a given point on a elementary surface.
291 -- The point should be on the surface.
294 Parameters (Pl : Pln from gp; P : Pnt from gp; U, V : out Real);
295 --- Purpose : parametrization
297 -- Pl.Location() + U * Pl.XDirection() + V * Pl.YDirection()
301 Parameters (C : Cylinder from gp; P : Pnt from gp; U, V : out Real);
302 --- Purpose : parametrization
303 -- P (U, V) = Location + V * ZDirection +
304 -- Radius * (Cos(U) * XDirection + Sin (U) * YDirection)
308 Parameters (C : Cone from gp; P : Pnt from gp; U, V : out Real);
309 --- Purpose : parametrization
310 -- P (U, V) = Location + V * ZDirection +
311 -- (Radius + V * Tan (SemiAngle)) *
312 -- (Cos(U) * XDirection + Sin(U) * YDirection)
316 Parameters (S : Sphere from gp; P : Pnt from gp; U, V : out Real);
317 --- Purpose : parametrization
318 -- P (U, V) = Location +
319 -- Radius * Cos (V) * (Cos (U) * XDirection + Sin (U) * YDirection) +
320 -- Radius * Sin (V) * ZDirection
324 Parameters (T : Torus from gp; P : Pnt from gp; U, V : out Real);
325 --- Purpose : parametrization
326 -- P (U, V) = Location +
327 -- (MajorRadius + MinorRadius * Cos(U)) *
328 -- (Cos(V) * XDirection - Sin(V) * YDirection) +
329 -- MinorRadius * Sin(U) * ZDirection
333 PlaneParameters (Pos: Ax3 from gp; P: Pnt from gp; U, V: out Real);
334 --- Purpose : parametrization
336 -- Pl.Location() + U * Pl.XDirection() + V * Pl.YDirection()
339 CylinderParameters (Pos: Ax3 from gp; Radius : Real; P: Pnt from gp;
341 --- Purpose : parametrization
342 -- P (U, V) = Location + V * ZDirection +
343 -- Radius * (Cos(U) * XDirection + Sin (U) * YDirection)
346 ConeParameters (Pos: Ax3 from gp; Radius, SAngle: Real; P: Pnt from gp;
348 --- Purpose : parametrization
349 -- P (U, V) = Location + V * ZDirection +
350 -- (Radius + V * Tan (SemiAngle)) *
351 -- (Cos(U) * XDirection + Sin(U) * YDirection)
354 SphereParameters (Pos: Ax3 from gp; Radius: Real; P: Pnt from gp;
356 --- Purpose : parametrization
357 -- P (U, V) = Location +
358 -- Radius * Cos (V) * (Cos (U) * XDirection + Sin (U) * YDirection) +
359 -- Radius * Sin (V) * ZDirection
362 TorusParameters (Pos: Ax3 from gp; MajorRadius, MinorRadius: Real;
363 P : Pnt from gp; U, V : out Real);
364 --- Purpose : parametrization
365 -- P (U, V) = Location +
366 -- (MajorRadius + MinorRadius * Cos(U)) *
367 -- (Cos(V) * XDirection - Sin(V) * YDirection) +
368 -- MinorRadius * Sin(U) * ZDirection
371 PlaneUIso (Pos: Ax3 from gp; U : Real)
372 --- Purpose : compute the U Isoparametric gp_Lin of the plane.
376 CylinderUIso (Pos: Ax3 from gp; Radius, U : Real)
377 --- Purpose : compute the U Isoparametric gp_Lin of the cylinder.
381 ConeUIso (Pos: Ax3 from gp; Radius, SAngle, U: Real)
382 --- Purpose : compute the U Isoparametric gp_Lin of the cone.
386 SphereUIso (Pos: Ax3 from gp; Radius, U : Real)
387 --- Purpose : compute the U Isoparametric gp_Circ of the sphere,
388 -- (the meridian is not trimmed).
389 returns Circ from gp;
392 TorusUIso (Pos: Ax3 from gp; MajorRadius, MinorRadius, U: Real)
393 --- Purpose : compute the U Isoparametric gp_Circ of the torus.
394 returns Circ from gp;
397 PlaneVIso (Pos: Ax3 from gp; V : Real)
398 --- Purpose : compute the V Isoparametric gp_Lin of the plane.
402 CylinderVIso (Pos: Ax3 from gp; Radius, V : Real)
403 --- Purpose : compute the V Isoparametric gp_Circ of the cylinder.
404 returns Circ from gp;
407 ConeVIso (Pos: Ax3 from gp; Radius, SAngle, V : Real)
408 --- Purpose : compute the V Isoparametric gp_Circ of the cone.
409 returns Circ from gp;
412 SphereVIso (Pos: Ax3 from gp; Radius, V : Real)
413 --- Purpose : compute the V Isoparametric gp_Circ of the sphere,
414 -- (the meridian is not trimmed).
415 returns Circ from gp;
418 TorusVIso (Pos: Ax3 from gp; MajorRadius, MinorRadius, V : Real)
419 --- Purpose : compute the V Isoparametric gp_Circ of the torus.
420 returns Circ from gp;