154aec42dbc86c8ad8a752c6de895850bdd53382
[occt.git] / src / gp / gp_Torus.cdl
1 -- Copyright (c) 1991-1999 Matra Datavision
2 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
3 --
4 -- This file is part of Open CASCADE Technology software library.
5 --
6 -- This library is free software; you can redistribute it and/or modify it under
7 -- the terms of the GNU Lesser General Public License version 2.1 as published
8 -- by the Free Software Foundation, with special exception defined in the file
9 -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 -- distribution for complete text of the license and disclaimer of any warranty.
11 --
12 -- Alternatively, this file may be used under the terms of Open CASCADE
13 -- commercial license or contractual agreement.
14
15 class Torus   from gp   inherits Storable
16
17         --- Purpose :
18         --  Describes a torus.
19         -- A torus is defined by its major and minor radii and
20         -- positioned in space with a coordinate system (a gp_Ax3
21         -- object) as follows:
22         -- -   The origin of the coordinate system is the center of the torus;
23         -- -   The surface is obtained by rotating a circle of radius
24         --   equal to the minor radius of the torus about the "main
25         --   Direction" of the coordinate system. This circle is
26         --   located in the plane defined by the origin, the "X
27         --   Direction" and the "main Direction" of the coordinate
28         --   system. It is centered on the "X Axis" of this coordinate
29         --   system, and located at a distance, from the origin of
30         --   this coordinate system, equal to the major radius of the   torus;
31         -- -   The "X Direction" and "Y Direction" define the
32         --   reference plane of the torus.
33         -- The coordinate system described above is the "local
34         -- coordinate system" of the torus.
35         -- Note: when a gp_Torus torus is converted into a
36         -- Geom_ToroidalSurface torus, some implicit properties
37         -- of its local coordinate system are used explicitly:
38         -- -   its origin, "X Direction", "Y Direction" and "main
39         --   Direction" are used directly to define the parametric
40         --   directions on the torus and the origin of the parameters,
41         -- -   its implicit orientation (right-handed or left-handed)
42         --   gives the orientation (direct, indirect) to the
43         --   Geom_ToroidalSurface torus.
44         -- See Also
45         -- gce_MakeTorus which provides functions for more
46         -- complex torus constructions
47         -- Geom_ToroidalSurface which provides additional
48         -- functions for constructing tori and works, in particular,
49         -- with the parametric equations of tori.
50
51
52
53
54 uses Array1OfReal from TColStd, 
55      Ax1          from gp,
56      Ax2          from gp,
57      Ax3          from gp,
58      Dir          from gp,
59      Pnt          from gp,
60      Trsf         from gp,
61      Vec          from gp
62
63 raises ConstructionError from Standard,
64        DimensionError    from Standard
65
66 is
67
68
69   Create  returns Torus;
70         ---C++: inline
71         --- Purpose : creates an indefinite Torus.
72
73   Create (A3 : Ax3; MajorRadius, MinorRadius : Real)   returns Torus
74         ---C++: inline
75         --- Purpose :
76         -- a torus centered on the origin of coordinate system
77         --   A3, with major radius MajorRadius and minor radius
78         --   MinorRadius, and with the reference plane defined
79         --   by the origin, the "X Direction" and the "Y Direction" of A3.
80         --  Warnings :
81         --  It is not forbidden to create a torus with
82         --  MajorRadius = MinorRadius = 0.0 
83         -- Raises ConstructionError if MinorRadius < 0.0 or if MajorRadius < 0.0
84      raises ConstructionError;
85     
86
87   SetAxis (me : in out; A1 : Ax1)
88         ---C++: inline
89         --- Purpose : Modifies this torus, by redefining its local coordinate
90         -- system so that:
91         -- -   its origin and "main Direction" become those of the
92         -- axis A1 (the "X Direction" and "Y Direction" are then recomputed).
93         -- Raises ConstructionError if the direction of A1 is parallel to the "XDirection"
94         --  of the coordinate system of the toroidal surface.
95      raises ConstructionError
96        
97      is static;
98
99   SetLocation (me : in out; Loc : Pnt)   is static;
100         ---C++:inline
101         --- Purpose : Changes the location of the torus.
102
103   SetMajorRadius (me : in out; MajorRadius : Real)
104         ---C++: inline
105         --- Purpose : Assigns value to the major radius  of this torus. 
106         -- Raises ConstructionError if MajorRadius - MinorRadius <= Resolution()
107      raises ConstructionError
108      
109      is static;
110
111   SetMinorRadius (me : in out; MinorRadius : Real)
112         ---C++: inline
113         --- Purpose : Assigns value to the  minor radius of this torus.
114         -- Raises ConstructionError if MinorRadius < 0.0 or if
115         --  MajorRadius - MinorRadius <= Resolution from gp.
116      raises ConstructionError
117        
118      is static;
119
120   SetPosition (me : in out; A3 : Ax3)   is static;
121         ---C++: inline
122         --- Purpose : Changes the local coordinate system of the surface.
123
124   Area (me)  returns Real  is static;
125         ---C++: inline
126         --- Purpose : Computes the area of the torus.
127
128   UReverse (me : in out)
129         ---C++: inline
130         ---Purpose: Reverses the   U   parametrization of   the  torus
131         --          reversing the YAxis.
132   is static;
133
134   VReverse (me : in out)
135         ---Purpose: Reverses the   V   parametrization of   the  torus
136         --          reversing the ZAxis.
137   is static;
138
139   Direct (me) returns Boolean from Standard
140         ---C++:inline
141         ---Purpose: returns true if the Ax3, the local coordinate system of this torus, is right handed.
142   is static;
143
144   Axis (me)   returns Ax1  is static;
145         ---C++:inline
146         --- Purpose : returns the symmetry axis of the torus.
147         ---C++: return const&
148
149   Coefficients (me; Coef : out Array1OfReal from TColStd)
150         --- Purpose :
151         --  Computes the coefficients of the implicit equation of the surface
152         --  in the absolute cartesian coordinate system :
153         -- Coef(1) * X**4 + Coef(2) * Y**4 + Coef(3) * Z**4 +
154         -- Coef(4) * X**3 * Y + Coef(5) * X**3 * Z + Coef(6) * Y**3 * X +
155         -- Coef(7) * Y**3 * Z + Coef(8) * Z**3 * X + Coef(9) * Z**3 * Y +
156         -- Coef(10) * X**2 * Y**2 + Coef(11) * X**2 * Z**2 +
157         -- Coef(12) * Y**2 * Z**2 + Coef(13) * X**3 + Coef(14) * Y**3 +
158         -- Coef(15) * Z**3 + Coef(16) * X**2 * Y + Coef(17) * X**2 * Z +
159         -- Coef(18) * Y**2 * X + Coef(19) * Y**2 * Z + Coef(20) * Z**2 * X +
160         -- Coef(21) * Z**2 * Y + Coef(22) * X**2 + Coef(23) * Y**2 +
161         -- Coef(24) * Z**2 + Coef(25) * X * Y + Coef(26) * X * Z +
162         -- Coef(27) * Y * Z + Coef(28) * X + Coef(29) * Y + Coef(30) *  Z + 
163         -- Coef(31) = 0.0
164         -- Raises DimensionError if the length of Coef is lower than 31.
165      raises DimensionError
166     
167      is static;
168
169   Location (me)  returns Pnt  is static;
170         ---C++:inline
171         --- Purpose : Returns the Torus's location.
172         ---C++: return const&
173
174   Position (me)  returns Ax3  is static;
175         --- Purpose : Returns the local coordinates system of the torus.
176         ---C++: inline
177         ---C++: return const&
178
179   MajorRadius (me) returns Real   is static;
180         --- Purpose : returns the major radius of the torus.
181         ---C++: inline
182
183   MinorRadius (me) returns Real   is static;
184         --- Purpose : returns the minor radius of the torus.
185         ---C++: inline
186
187   Volume (me)  returns Real  is static;
188         --- Purpose : Computes the volume of the torus.
189         ---C++: inline
190
191   XAxis (me)  returns Ax1   is static;
192         ---C++:inline
193         --- Purpose : returns the axis X of the torus.
194
195   YAxis (me)  returns Ax1  is static;
196         ---C++:inline
197         --- Purpose : returns the axis Y of the torus.
198
199        
200   Mirror (me : in out; P : Pnt)   
201        is static;
202
203   Mirrored (me; P : Pnt)  returns Torus  is static;
204  --- Purpose :
205         --  Performs the symmetrical transformation of a torus 
206         --  with respect to the point P which is the center of the 
207         --  symmetry.
208
209                     
210    
211   Mirror (me : in out; A1 : Ax1)    
212        is static;
213
214   Mirrored (me; A1 : Ax1)   returns Torus  is static;
215         --- Purpose :
216         --  Performs the symmetrical transformation of a torus with
217         --  respect to an axis placement which is the axis of the
218         --  symmetry.
219
220
221
222      
223   Mirror (me : in out; A2 : Ax2)    
224         is static;
225
226   Mirrored (me; A2 : Ax2)    returns Torus  is static;
227         --- Purpose :
228         --  Performs the symmetrical transformation of a torus with respect 
229         --  to a plane. The axis placement A2 locates the plane of the
230         --  of the symmetry : (Location, XDirection, YDirection).
231
232
233   Rotate (me : in out; A1 : Ax1; Ang : Real)
234         ---C++:inline
235         is static;
236
237   Rotated (me; A1 : Ax1; Ang : Real) returns Torus  is static;
238         ---C++:inline
239
240         --- Purpose :
241         --  Rotates a torus. A1 is the axis of the rotation.
242         --  Ang is the angular value of the rotation in radians.
243
244
245
246   Scale (me : in out; P : Pnt; S : Real)         is static;
247         ---C++:inline
248
249   Scaled (me; P : Pnt; S : Real)  returns Torus  is static;
250         ---C++:inline
251
252
253         --- Purpose : 
254         --  Scales a torus. S is the scaling value.
255         --  The absolute value of S is used to scale the torus
256
257
258
259   Transform (me : in out; T : Trsf)              is static;
260         ---C++:inline
261
262   Transformed (me; T : Trsf)     returns Torus   is static;
263         ---C++:inline
264
265         --- Purpose :
266         --  Transforms a torus with the transformation T from class Trsf.
267
268       
269        
270
271   Translate (me : in out; V : Vec) 
272         ---C++:inline
273         is static;
274
275   Translated (me; V : Vec)  returns Torus  is static;
276         ---C++:inline
277         --- Purpose :
278         --  Translates a torus in the direction of the vector V.
279         --  The magnitude of the translation is the vector's magnitude.
280
281      
282   Translate (me : in out; P1, P2 : Pnt)         is static;   
283         ---C++:inline
284
285   Translated (me; P1, P2 : Pnt)  returns Torus  is static;
286         ---C++:inline
287         --- Purpose :
288         --  Translates a torus from the point P1 to the point P2.
289
290
291
292 fields
293
294   pos         : Ax3;
295   majorRadius : Real;
296   minorRadius : Real;
297
298 end;
299
300