b311480e |
1 | -- Created on: 1993-03-10 |
2 | -- Created by: JCV |
3 | -- Copyright (c) 1993-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 SphericalSurface from Geom inherits ElementarySurface from Geom |
18 | |
19 | --- Purpose : Describes a sphere. |
20 | -- A sphere is defined by its radius, and is positioned in |
21 | -- space by a coordinate system (a gp_Ax3 object), the |
22 | -- origin of which is the center of the sphere. |
23 | -- This coordinate system is the "local coordinate |
24 | -- system" of the sphere. The following apply: |
25 | -- - Rotation around its "main Axis", in the trigonometric |
26 | -- sense given by the "X Direction" and the "Y |
27 | -- Direction", defines the u parametric direction. |
28 | -- - Its "X Axis" gives the origin for the u parameter. |
29 | -- - The "reference meridian" of the sphere is a |
30 | -- half-circle, of radius equal to the radius of the |
31 | -- sphere. It is located in the plane defined by the |
32 | -- origin, "X Direction" and "main Direction", centered |
33 | -- on the origin, and positioned on the positive side of the "X Axis". |
34 | -- - Rotation around the "Y Axis" gives the v parameter |
35 | -- on the reference meridian. |
36 | -- - The "X Axis" gives the origin of the v parameter on |
37 | -- the reference meridian. |
38 | -- - The v parametric direction is oriented by the "main |
39 | -- Direction", i.e. when v increases, the Z coordinate |
40 | -- increases. (This implies that the "Y Direction" |
41 | -- orients the reference meridian only when the local |
42 | -- coordinate system is indirect.) |
43 | -- - The u isoparametric curve is a half-circle obtained |
44 | -- by rotating the reference meridian of the sphere |
45 | -- through an angle u around the "main Axis", in the |
46 | -- trigonometric sense defined by the "X Direction" |
47 | -- and the "Y Direction". |
48 | -- The parametric equation of the sphere is: |
49 | -- P(u,v) = O + R*cos(v)*(cos(u)*XDir + sin(u)*YDir)+R*sin(v)*ZDir |
50 | -- where: |
51 | -- - O, XDir, YDir and ZDir are respectively the |
52 | -- origin, the "X Direction", the "Y Direction" and the "Z |
53 | -- Direction" of its local coordinate system, and |
54 | -- - R is the radius of the sphere. |
55 | -- The parametric range of the two parameters is: |
56 | -- - [ 0, 2.*Pi ] for u, and |
57 | -- - [ - Pi/2., + Pi/2. ] for v. |
58 | |
59 | uses Ax3 from gp, |
60 | Pnt from gp, |
61 | Sphere from gp, |
62 | Trsf from gp, |
63 | Vec from gp, |
64 | Curve from Geom, |
65 | Geometry from Geom |
66 | |
67 | raises ConstructionError from Standard, |
68 | RangeError from Standard |
69 | |
70 | is |
71 | |
6e33d3ce |
72 | Create (A3 : Ax3; Radius : Real) returns SphericalSurface |
7fd59977 |
73 | --- Purpose : |
74 | -- A3 is the local coordinate system of the surface. |
75 | -- At the creation the parametrization of the surface is defined |
76 | -- such as the normal Vector (N = D1U ^ D1V) is directed away from |
77 | -- the center of the sphere. |
78 | -- The direction of increasing parametric value V is defined by the |
79 | -- rotation around the "YDirection" of A2 in the trigonometric sense |
80 | -- and the orientation of increasing parametric value U is defined |
81 | -- by the rotation around the main direction of A2 in the |
82 | -- trigonometric sense. |
83 | -- Warnings : |
84 | -- It is not forbidden to create a spherical surface with |
85 | -- Radius = 0.0 |
86 | raises ConstructionError; |
87 | --- Purpose : Raised if Radius < 0.0. |
88 | |
89 | |
6e33d3ce |
90 | Create (S : Sphere) returns SphericalSurface; |
7fd59977 |
91 | --- Purpose : |
92 | -- Creates a SphericalSurface from a non persistent Sphere from |
93 | -- package gp. |
94 | |
95 | |
96 | SetRadius (me : mutable; R : Real) |
97 | raises ConstructionError; |
98 | --- Purpose : Assigns the value R to the radius of this sphere. |
99 | -- Exceptions Standard_ConstructionError if R is less than 0.0. |
100 | |
101 | |
102 | SetSphere (me : mutable; S : Sphere); |
103 | --- Purpose : Converts the gp_Sphere S into this sphere. |
104 | |
105 | |
106 | Sphere (me) returns Sphere; |
107 | --- Purpose : Returns a non persistent sphere with the same geometric |
108 | -- properties as <me>. |
109 | |
110 | |
111 | UReversedParameter(me; U : Real) returns Real; |
112 | ---Purpose: Computes the u parameter on the modified |
113 | -- surface, when reversing its u parametric |
114 | -- direction, for any point of u parameter U on this sphere. |
115 | -- In the case of a sphere, these functions returns 2.PI - U. |
116 | |
117 | |
118 | VReversedParameter(me; V : Real) returns Real; |
119 | ---Purpose: Computes the v parameter on the modified |
120 | -- surface, when reversing its v parametric |
121 | -- direction, for any point of v parameter V on this sphere. |
122 | -- In the case of a sphere, these functions returns -U. |
123 | |
124 | |
125 | Area (me) returns Real; |
126 | --- Purpose : Computes the aera of the spherical surface. |
127 | |
128 | |
129 | Bounds (me; U1, U2, V1, V2 : out Real); |
130 | --- Purpose : Returns the parametric bounds U1, U2, V1 and V2 of this sphere. |
131 | -- For a sphere: U1 = 0, U2 = 2*PI, V1 = -PI/2, V2 = PI/2. |
132 | |
133 | |
134 | Coefficients (me; A1, A2, A3, B1, B2, B3, C1, C2, C3, D : out Real); |
135 | --- Purpose : Returns the coefficients of the implicit equation of the |
136 | -- quadric in the absolute cartesian coordinates system : |
137 | -- These coefficients are normalized. |
138 | -- A1.X**2 + A2.Y**2 + A3.Z**2 + 2.(B1.X.Y + B2.X.Z + B3.Y.Z) + |
139 | -- 2.(C1.X + C2.Y + C3.Z) + D = 0.0 |
140 | |
141 | |
142 | Radius (me) returns Real; |
143 | |
144 | ---Purpose: Computes the coefficients of the implicit equation of |
145 | -- this quadric in the absolute Cartesian coordinate system: |
146 | -- A1.X**2 + A2.Y**2 + A3.Z**2 + 2.(B1.X.Y + B2.X.Z + B3.Y.Z) + |
147 | -- 2.(C1.X + C2.Y + C3.Z) + D = 0.0 |
148 | -- An implicit normalization is applied (i.e. A1 = A2 = 1. |
149 | -- in the local coordinate system of this sphere). |
150 | |
151 | Volume (me) returns Real; |
152 | --- Purpose : Computes the volume of the spherical surface. |
153 | |
154 | |
155 | IsUClosed (me) returns Boolean; |
156 | --- Purpose : Returns True. |
157 | |
158 | |
159 | IsVClosed (me) returns Boolean; |
160 | --- Purpose : Returns False. |
161 | |
162 | |
163 | IsUPeriodic (me) returns Boolean; |
164 | --- Purpose : Returns True. |
165 | |
166 | |
167 | IsVPeriodic (me) returns Boolean; |
168 | --- Purpose : Returns False. |
169 | |
170 | |
6e33d3ce |
171 | UIso (me; U : Real) returns Curve; |
7fd59977 |
172 | --- Purpose : Computes the U isoparametric curve. |
173 | -- The U isoparametric curves of the surface are defined by the |
174 | -- section of the spherical surface with plane obtained by rotation |
175 | -- of the plane (Location, XAxis, ZAxis) around ZAxis. This plane |
176 | -- defines the origin of parametrization u. |
177 | -- For a SphericalSurface the UIso curve is a Circle. |
178 | -- Warnings : The radius of this circle can be zero. |
179 | |
180 | |
6e33d3ce |
181 | VIso (me; V : Real) returns Curve; |
7fd59977 |
182 | --- Purpose : Computes the V isoparametric curve. |
183 | -- The V isoparametric curves of the surface are defined by |
184 | -- the section of the spherical surface with plane parallel to the |
185 | -- plane (Location, XAxis, YAxis). This plane defines the origin of |
186 | -- parametrization V. |
187 | -- Be careful if V is close to PI/2 or 3*PI/2 the radius of the |
188 | -- circle becomes tiny. It is not forbidden in this toolkit to |
189 | -- create circle with radius = 0.0 |
190 | -- For a SphericalSurface the VIso curve is a Circle. |
191 | -- Warnings : The radius of this circle can be zero. |
192 | |
193 | |
194 | D0 (me; U, V : Real; P : out Pnt); |
195 | --- Purpose : |
196 | -- Computes the point P (U, V) on the surface. |
197 | -- P (U, V) = Loc + Radius * Sin (V) * Zdir + |
198 | -- Radius * Cos (V) * (cos (U) * XDir + sin (U) * YDir) |
199 | -- where Loc is the origin of the placement plane (XAxis, YAxis) |
200 | -- XDir is the direction of the XAxis and YDir the direction of |
201 | -- the YAxis and ZDir the direction of the ZAxis. |
202 | |
203 | |
204 | D1 (me; U, V : Real; P : out Pnt; D1U, D1V : out Vec); |
205 | --- Purpose : |
206 | -- Computes the current point and the first derivatives in the |
207 | -- directions U and V. |
208 | |
209 | |
210 | D2 (me; U, V : Real; P : out Pnt; D1U, D1V, D2U, D2V, D2UV : out Vec); |
211 | --- Purpose : |
212 | -- Computes the current point, the first and the second derivatives |
213 | -- in the directions U and V. |
214 | |
215 | |
216 | D3 (me; U, V : Real; P : out Pnt; |
217 | D1U, D1V, D2U, D2V, D2UV, D3U, D3V, D3UUV, D3UVV : out Vec); |
218 | --- Purpose : |
219 | -- Computes the current point, the first,the second and the third |
220 | -- derivatives in the directions U and V. |
221 | |
222 | |
223 | DN (me; U, V : Real; Nu, Nv : Integer) returns Vec |
224 | --- Purpose : |
225 | -- Computes the derivative of order Nu in the direction u |
226 | -- and Nv in the direction v. |
227 | raises RangeError; |
228 | --- Purpose : Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0. |
229 | |
230 | |
231 | Transform (me : mutable; T : Trsf) ; |
232 | ---Purpose: Applies the transformation T to this sphere. |
6e33d3ce |
233 | Copy (me) returns like me; |
7fd59977 |
234 | ---Purpose: Creates a new object which is a copy of this sphere. |
235 | fields |
236 | |
237 | radius : Real; |
238 | |
239 | |
240 | end; |