b311480e |
1 | -- Created on: 1993-08-02 |
2 | -- Created by: Laurent BOURESCHE |
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 | |
087da3bd |
17 | class Ax3 from gp |
7fd59977 |
18 | |
19 | --- Purpose : Describes a coordinate system in 3D space. Unlike a |
20 | -- gp_Ax2 coordinate system, a gp_Ax3 can be |
21 | -- right-handed ("direct sense") or left-handed ("indirect sense"). |
22 | -- A coordinate system is defined by: |
23 | -- - its origin (also referred to as its "Location point"), and |
24 | -- - three orthogonal unit vectors, termed the "X |
25 | -- Direction", the "Y Direction" and the "Direction" (also |
26 | -- referred to as the "main Direction"). |
27 | -- The "Direction" of the coordinate system is called its |
28 | -- "main Direction" because whenever this unit vector is |
29 | -- modified, the "X Direction" and the "Y Direction" are |
30 | -- recomputed. However, when we modify either the "X |
31 | -- Direction" or the "Y Direction", "Direction" is not modified. |
32 | -- "Direction" is also the "Z Direction". |
33 | -- The "main Direction" is always parallel to the cross |
34 | -- product of its "X Direction" and "Y Direction". |
35 | -- If the coordinate system is right-handed, it satisfies the equation: |
36 | -- "main Direction" = "X Direction" ^ "Y Direction" |
37 | -- and if it is left-handed, it satisfies the equation: |
38 | -- "main Direction" = -"X Direction" ^ "Y Direction" |
39 | -- A coordinate system is used: |
40 | -- - to describe geometric entities, in particular to position |
41 | -- them. The local coordinate system of a geometric |
42 | -- entity serves the same purpose as the STEP function |
43 | -- "axis placement three axes", or |
44 | -- - to define geometric transformations. |
45 | -- Note: |
46 | -- - We refer to the "X Axis", "Y Axis" and "Z Axis", |
47 | -- respectively, as the axes having: |
48 | -- - the origin of the coordinate system as their origin, and |
49 | -- - the unit vectors "X Direction", "Y Direction" and |
50 | -- "main Direction", respectively, as their unit vectors. |
51 | -- - The "Z Axis" is also the "main Axis". |
52 | -- - gp_Ax2 is used to define a coordinate system that must be always right-handed. |
53 | |
54 | uses Ax1 from gp, |
55 | Ax2 from gp, |
56 | Dir from gp, |
57 | Pnt from gp, |
58 | Trsf from gp, |
59 | Vec from gp |
60 | |
61 | raises ConstructionError from Standard |
62 | |
63 | is |
64 | |
65 | Create returns Ax3 from gp; |
66 | --- Purpose : Creates an object corresponding to the reference |
67 | -- coordinate system (OXYZ). |
68 | |
69 | Create (A : Ax2 from gp) returns Ax3 from gp; |
70 | ---Purpose: Creates a coordinate system from a right-handed |
71 | -- coordinate system. |
72 | |
73 | Create (P : Pnt from gp; N, Vx : Dir from gp) returns Ax3 from gp |
74 | --- Purpose : Creates a right handed axis placement with the |
75 | -- "Location" point P and two directions, N gives the |
76 | -- "Direction" and Vx gives the "XDirection". |
77 | -- Raises ConstructionError if N and Vx are parallel (same or opposite orientation). |
78 | raises ConstructionError; |
79 | |
80 | |
81 | Create (P : Pnt from gp; V : Dir from gp) returns Ax3 from gp; |
82 | --- Purpose : |
83 | -- Creates an axis placement with the "Location" point <P> |
84 | -- and the normal direction <V>. |
85 | |
86 | XReverse(me : in out) |
87 | ---Purpose: Reverses the X direction of <me>. |
88 | is static; |
89 | |
90 | YReverse(me : in out) |
91 | ---Purpose: Reverses the Y direction of <me>. |
92 | is static; |
93 | |
94 | ZReverse(me : in out) |
95 | ---Purpose: Reverses the Z direction of <me>. |
96 | is static; |
97 | |
98 | |
99 | SetAxis (me : in out; A1 : Ax1) |
100 | --- Purpose : Assigns the origin and "main Direction" of the axis A1 to |
101 | -- this coordinate system, then recomputes its "X Direction" and "Y Direction". |
102 | -- Note: |
103 | -- - The new "X Direction" is computed as follows: |
104 | -- new "X Direction" = V1 ^(previous "X Direction" ^ V) |
105 | -- where V is the "Direction" of A1. |
106 | -- - The orientation of this coordinate system |
107 | -- (right-handed or left-handed) is not modified. |
108 | -- Raises ConstructionError if the "Direction" of <A1> and the "XDirection" of <me> |
109 | -- are parallel (same or opposite orientation) because it is |
110 | -- impossible to calculate the new "XDirection" and the new |
111 | -- "YDirection". |
112 | raises ConstructionError |
113 | |
114 | is static; |
115 | |
116 | |
117 | SetDirection (me : in out; V : Dir) |
118 | --- Purpose : |
119 | -- Changes the main direction of this coordinate system, |
120 | -- then recomputes its "X Direction" and "Y Direction". |
121 | -- Note: |
122 | -- - The new "X Direction" is computed as follows: |
123 | -- new "X Direction" = V ^ (previous "X Direction" ^ V). |
124 | -- - The orientation of this coordinate system (left- or right-handed) is not modified. |
125 | -- Raises ConstructionError if <V< and the previous "XDirection" are parallel |
126 | -- because it is impossible to calculate the new "XDirection" |
127 | -- and the new "YDirection". |
128 | raises ConstructionError |
129 | |
130 | is static; |
131 | |
132 | |
133 | SetLocation (me : in out; P : Pnt) is static; |
134 | --- Purpose : |
135 | -- Changes the "Location" point (origin) of <me>. |
136 | |
137 | |
138 | SetXDirection (me : in out; Vx : Dir) |
139 | --- Purpose : |
140 | -- Changes the "Xdirection" of <me>. The main direction |
141 | -- "Direction" is not modified, the "Ydirection" is modified. |
142 | -- If <Vx> is not normal to the main direction then <XDirection> |
143 | -- is computed as follows XDirection = Direction ^ (Vx ^ Direction). |
144 | -- Raises ConstructionError if <Vx> is parallel (same or opposite |
145 | -- orientation) to the main direction of <me> |
146 | raises ConstructionError |
147 | |
148 | is static; |
149 | |
150 | |
151 | SetYDirection(me : in out; Vy : Dir) |
152 | ---C++:inline |
153 | --- Purpose : |
154 | -- Changes the "Ydirection" of <me>. The main direction is not |
155 | -- modified but the "Xdirection" is changed. |
156 | -- If <Vy> is not normal to the main direction then "YDirection" |
157 | -- is computed as follows |
158 | -- YDirection = Direction ^ (<Vy> ^ Direction). |
159 | -- Raises ConstructionError if <Vy> is parallel to the main direction of <me> |
160 | raises ConstructionError |
161 | |
162 | is static; |
163 | |
164 | Angle (me; Other : Ax3) returns Real is static; |
165 | ---C++:inline |
166 | --- Purpose : |
167 | -- Computes the angular value between the main direction of |
168 | -- <me> and the main direction of <Other>. Returns the angle |
169 | -- between 0 and PI in radians. |
170 | |
171 | Axis (me) returns Ax1 is static; |
172 | ---C++:inline |
173 | --- Purpose : |
174 | -- Returns the main axis of <me>. It is the "Location" point |
175 | -- and the main "Direction". |
176 | ---C++: return const& |
177 | |
178 | Ax2 (me) returns Ax2 from gp |
179 | ---Purpose: Computes a right-handed coordinate system with the |
180 | -- same "X Direction" and "Y Direction" as those of this |
181 | -- coordinate system, then recomputes the "main Direction". |
182 | -- If this coordinate system is right-handed, the result |
183 | -- returned is the same coordinate system. If this |
184 | -- coordinate system is left-handed, the result is reversed. |
185 | is static; |
186 | |
187 | Direction (me) returns Dir is static; |
188 | ---C++:inline |
189 | --- Purpose : |
190 | -- Returns the main direction of <me>. |
191 | ---C++: return const& |
192 | |
193 | |
194 | Location (me) returns Pnt is static; |
195 | ---C++:inline |
196 | --- Purpose : |
197 | -- Returns the "Location" point (origin) of <me>. |
198 | ---C++: return const& |
199 | |
200 | |
201 | XDirection (me) returns Dir is static; |
202 | ---C++:inline |
203 | --- Purpose : |
204 | -- Returns the "XDirection" of <me>. |
205 | ---C++: return const& |
206 | |
207 | |
208 | YDirection(me) returns Dir is static; |
209 | ---C++:inline |
210 | --- Purpose : |
211 | -- Returns the "YDirection" of <me>. |
212 | ---C++: return const& |
213 | |
214 | |
215 | Direct(me) returns Boolean |
216 | ---C++:inline |
217 | ---Purpose: Returns True if the coordinate system is right-handed. i.e. |
218 | -- XDirection().Crossed(YDirection()).Dot(Direction()) > 0 |
219 | is static; |
220 | |
221 | |
222 | |
223 | IsCoplanar (me; Other : Ax3; LinearTolerance, AngularTolerance : Real) |
224 | returns Boolean |
225 | is static; |
226 | ---C++:inline |
227 | --- Purpose : |
228 | -- Returns True if |
229 | -- . the distance between the "Location" point of <me> and |
230 | -- <Other> is lower or equal to LinearTolerance and |
231 | -- . the distance between the "Location" point of <Other> and |
232 | -- <me> is lower or equal to LinearTolerance and |
233 | -- . the main direction of <me> and the main direction of |
234 | -- <Other> are parallel (same or opposite orientation). |
235 | |
236 | |
237 | IsCoplanar (me; A1 : Ax1; LinearTolerance, AngularTolerance : Real) |
238 | returns Boolean |
239 | is static; |
240 | ---C++:inline |
241 | --- Purpose : Returns True if |
242 | -- . the distance between <me> and the "Location" point of A1 |
243 | -- is lower of equal to LinearTolerance and |
244 | -- . the distance between A1 and the "Location" point of <me> |
245 | -- is lower or equal to LinearTolerance and |
246 | -- . the main direction of <me> and the direction of A1 are normal. |
247 | |
248 | |
249 | Mirror (me : in out; P : Pnt) is static; |
250 | |
251 | Mirrored (me; P : Pnt) returns Ax3 is static; |
252 | |
253 | |
254 | --- Purpose : |
255 | -- Performs the symmetrical transformation of an axis |
256 | -- placement with respect to the point P which is the |
257 | -- center of the symmetry. |
258 | -- Warnings : |
259 | -- The main direction of the axis placement is not changed. |
260 | -- The "XDirection" and the "YDirection" are reversed. |
261 | -- So the axis placement stay right handed. |
262 | |
263 | Mirror (me : in out; A1 : Ax1) is static; |
264 | |
265 | Mirrored (me; A1 : Ax1) returns Ax3 is static; |
266 | |
267 | --- Purpose : |
268 | -- Performs the symmetrical transformation of an axis |
269 | -- placement with respect to an axis placement which |
270 | -- is the axis of the symmetry. |
271 | -- The transformation is performed on the "Location" |
272 | -- point, on the "XDirection" and "YDirection". |
273 | -- The resulting main "Direction" is the cross product between |
274 | -- the "XDirection" and the "YDirection" after transformation. |
275 | |
276 | |
277 | |
278 | Mirror (me : in out; A2 : Ax2) is static; |
279 | |
280 | Mirrored (me; A2 : Ax2) returns Ax3 is static; |
281 | |
282 | --- Purpose : |
283 | -- Performs the symmetrical transformation of an axis |
284 | -- placement with respect to a plane. |
285 | -- The axis placement <A2> locates the plane of the symmetry : |
286 | -- (Location, XDirection, YDirection). |
287 | -- The transformation is performed on the "Location" |
288 | -- point, on the "XDirection" and "YDirection". |
289 | -- The resulting main "Direction" is the cross product between |
290 | -- the "XDirection" and the "YDirection" after transformation. |
291 | |
292 | |
293 | Rotate (me : in out; A1 : Ax1; Ang : Real) is static; |
294 | Rotated (me; A1 : Ax1; Ang : Real) returns Ax3 is static; |
295 | |
296 | --- Purpose : |
297 | -- Rotates an axis placement. <A1> is the axis of the |
298 | -- rotation . Ang is the angular value of the rotation |
299 | -- in radians. |
300 | |
301 | |
302 | Scale (me : in out; P : Pnt; S : Real) is static; |
303 | Scaled (me; P : Pnt; S : Real) returns Ax3 is static; |
304 | --- Purpose : |
305 | -- Applies a scaling transformation on the axis placement. |
306 | -- The "Location" point of the axisplacement is modified. |
307 | -- Warnings : |
308 | -- If the scale <S> is negative : |
309 | -- . the main direction of the axis placement is not changed. |
310 | -- . The "XDirection" and the "YDirection" are reversed. |
311 | -- So the axis placement stay right handed. |
312 | |
313 | |
314 | |
315 | Transform (me : in out; T : Trsf) is static; |
316 | Transformed (me; T : Trsf) returns Ax3 is static; |
317 | --- Purpose : |
318 | -- Transforms an axis placement with a Trsf. |
319 | -- The "Location" point, the "XDirection" and the |
320 | -- "YDirection" are transformed with T. The resulting |
321 | -- main "Direction" of <me> is the cross product between |
322 | -- the "XDirection" and the "YDirection" after transformation. |
323 | |
324 | |
325 | |
326 | |
327 | Translate (me : in out; V : Vec) is static; |
328 | Translated (me; V : Vec) returns Ax3 is static; |
329 | --- Purpose : |
330 | -- Translates an axis plaxement in the direction of the vector |
331 | -- <V>. The magnitude of the translation is the vector's magnitude. |
332 | |
333 | |
334 | |
335 | Translate (me : in out; P1, P2 : Pnt) is static; |
336 | Translated (me; P1, P2 : Pnt) returns Ax3 is static; |
337 | |
338 | --- Purpose : |
339 | -- Translates an axis placement from the point <P1> to the |
340 | -- point <P2>. |
341 | |
342 | fields |
343 | |
344 | axis : Ax1 from gp; |
345 | vydir : Dir from gp; |
346 | vxdir : Dir from gp; |
347 | |
348 | end; |
349 | |