1 -- Copyright (c) 1991-1999 Matra Datavision
2 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
4 -- This file is part of Open CASCADE Technology software library.
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.
12 -- Alternatively, this file may be used under the terms of Open CASCADE
13 -- commercial license or contractual agreement.
15 class XYZ from gp inherits Storable
18 -- This class describes a cartesian coordinate entity in
19 -- 3D space {X,Y,Z}. This entity is used for algebraic
20 -- calculation. This entity can be transformed
21 -- with a "Trsf" or a "GTrsf" from package "gp".
22 -- It is used in vectorial computations or for holding this type
23 -- of information in data structures.
26 raises ConstructionError from Standard,
27 OutOfRange from Standard
34 --- Purpose : Creates an XYZ object with zero co-ordinates (0,0,0)
36 Create (X, Y, Z : Real) returns XYZ;
38 --- Purpose : creates an XYZ with given coordinates
40 SetCoord (me : in out; X, Y, Z : Real)
42 ---Purpose: For this XYZ object, assigns
43 -- the values X, Y and Z to its three coordinates
46 SetCoord (me : in out; Index : Integer; Xi : Real)
49 -- modifies the coordinate of range Index
50 -- Index = 1 => X is modified
51 -- Index = 2 => Y is modified
52 -- Index = 3 => Z is modified
53 -- Raises OutOfRange if Index != {1, 2, 3}.
57 SetX (me: in out; X : Real) is static;
59 ---Purpose: Assigns the given value to the X coordinate
61 SetY (me: in out; Y : Real) is static;
63 ---Purpose: Assigns the given value to the Y coordinate
65 SetZ (me: in out; Z : Real) is static;
67 ---Purpose: Assigns the given value to the Z coordinate
69 Coord (me; Index : Integer) returns Real
72 -- returns the coordinate of range Index :
73 -- Index = 1 => X is returned
74 -- Index = 2 => Y is returned
75 -- Index = 3 => Z is returned
77 -- Raises OutOfRange if Index != {1, 2, 3}.
81 Coord (me; X, Y, Z : out Real) is static;
83 --Purpose: For this XYZ object, returns:
84 -- - its coordinates X, Y, and Z
86 X (me) returns Real is static;
88 ---Purpose: Returns the X coordinate
90 Y (me) returns Real is static;
92 ---Purpose: Returns the Y coordinate
94 Z (me) returns Real is static;
96 ---Purpose: Returns the Z coordinate
98 Modulus (me) returns Real is static;
99 --- Purpose : computes Sqrt (X*X + Y*Y + Z*Z) where X, Y and Z are the three coordinates of this XYZ object.
102 SquareModulus (me) returns Real is static;
103 --- Purpose : Computes X*X + Y*Y + Z*Z where X, Y and Z are the three coordinates of this XYZ object.
106 IsEqual (me; Other : XYZ; Tolerance : Real) returns Boolean
108 -- Returns True if he coordinates of this XYZ object are
109 -- equal to the respective coordinates Other,
110 -- within the specified tolerance Tolerance. I.e.:
111 -- abs(<me>.X() - Other.X()) <= Tolerance and
112 -- abs(<me>.Y() - Other.Y()) <= Tolerance and
113 -- abs(<me>.Z() - Other.Z()) <= Tolerance.
117 Add (me : in out; Other : XYZ) is static;
119 -- <me>.X() = <me>.X() + Other.X()
120 -- <me>.Y() = <me>.Y() + Other.Y()
121 -- <me>.Z() = <me>.Z() + Other.Z()
123 ---C++: alias operator +=
125 Added (me; Other : XYZ) returns XYZ is static;
128 -- new.X() = <me>.X() + Other.X()
129 -- new.Y() = <me>.Y() + Other.Y()
130 -- new.Z() = <me>.Z() + Other.Z()
131 ---C++: alias operator +
133 Cross (me : in out; Right : XYZ) is static;
135 ---C++: alias operator ^=
137 -- <me>.X() = <me>.Y() * Other.Z() - <me>.Z() * Other.Y()
138 -- <me>.Y() = <me>.Z() * Other.X() - <me>.X() * Other.Z()
139 -- <me>.Z() = <me>.X() * Other.Y() - <me>.Y() * Other.X()
141 Crossed (me; Right : XYZ) returns XYZ is static;
143 ---C++: alias operator ^
145 -- new.X() = <me>.Y() * Other.Z() - <me>.Z() * Other.Y()
146 -- new.Y() = <me>.Z() * Other.X() - <me>.X() * Other.Z()
147 -- new.Z() = <me>.X() * Other.Y() - <me>.Y() * Other.X()
149 CrossMagnitude (me; Right : XYZ) returns Real is static;
152 -- Computes the magnitude of the cross product between <me> and
153 -- Right. Returns || <me> ^ Right ||
155 CrossSquareMagnitude (me; Right : XYZ) returns Real is static;
158 -- Computes the square magnitude of the cross product between <me> and
159 -- Right. Returns || <me> ^ Right ||**2
161 CrossCross (me : in out; Coord1, Coord2 : XYZ) is static;
163 --- Purposes : Triple vector product
164 -- Computes <me> = <me>.Cross(Coord1.Cross(Coord2))
166 CrossCrossed (me; Coord1, Coord2 : XYZ) returns XYZ is static;
168 --- Purposes : Triple vector product
169 -- computes New = <me>.Cross(Coord1.Cross(Coord2))
171 Divide (me : in out; Scalar : Real) is static;
172 --- Purpose : divides <me> by a real.
174 ---C++: alias operator /=
176 Divided (me; Scalar : Real) returns XYZ is static;
178 --- Purpose : divides <me> by a real.
179 ---C++: alias operator /
181 Dot (me; Other : XYZ) returns Real
182 --- Purpose : computes the scalar product between <me> and Other
184 ---C++: alias operator *
187 DotCross (me; Coord1, Coord2 : XYZ) returns Real is static;
189 --- Purpose : computes the triple scalar product
191 Multiply (me : in out; Scalar : Real) is static;
193 ---C++: alias operator *=
195 -- <me>.X() = <me>.X() * Scalar;
196 -- <me>.Y() = <me>.Y() * Scalar;
197 -- <me>.Z() = <me>.Z() * Scalar;
199 Multiply (me : in out; Other : XYZ) is static;
201 ---C++: alias operator *=
203 -- <me>.X() = <me>.X() * Other.X();
204 -- <me>.Y() = <me>.Y() * Other.Y();
205 -- <me>.Z() = <me>.Z() * Other.Z();
207 Multiply (me : in out; Matrix : Mat) is static;
209 ---C++: alias operator *=
210 --- Purpose : <me> = Matrix * <me>
212 Multiplied (me; Scalar : Real) returns XYZ is static;
215 -- New.X() = <me>.X() * Scalar;
216 -- New.Y() = <me>.Y() * Scalar;
217 -- New.Z() = <me>.Z() * Scalar;
218 ---C++: alias operator *
220 Multiplied (me; Other : XYZ) returns XYZ is static;
223 -- new.X() = <me>.X() * Other.X();
224 -- new.Y() = <me>.Y() * Other.Y();
225 -- new.Z() = <me>.Z() * Other.Z();
227 Multiplied (me; Matrix : Mat) returns XYZ is static;
229 --- Purpose : New = Matrix * <me>
230 ---C++: alias operator *
232 Normalize (me : in out)
235 -- <me>.X() = <me>.X()/ <me>.Modulus()
236 -- <me>.Y() = <me>.Y()/ <me>.Modulus()
237 -- <me>.Z() = <me>.Z()/ <me>.Modulus()
238 raises ConstructionError
239 --- Purpose : Raised if <me>.Modulus() <= Resolution from gp
242 Normalized (me) returns XYZ
245 -- New.X() = <me>.X()/ <me>.Modulus()
246 -- New.Y() = <me>.Y()/ <me>.Modulus()
247 -- New.Z() = <me>.Z()/ <me>.Modulus()
248 raises ConstructionError
249 --- Purpose : Raised if <me>.Modulus() <= Resolution from gp
252 Reverse (me : in out) is static;
255 -- <me>.X() = -<me>.X()
256 -- <me>.Y() = -<me>.Y()
257 -- <me>.Z() = -<me>.Z()
259 Reversed (me) returns XYZ is static;
262 -- New.X() = -<me>.X()
263 -- New.Y() = -<me>.Y()
264 -- New.Z() = -<me>.Z()
266 Subtract (me : in out; Right : XYZ) is static;
268 ---C++: alias operator -=
270 -- <me>.X() = <me>.X() - Other.X()
271 -- <me>.Y() = <me>.Y() - Other.Y()
272 -- <me>.Z() = <me>.Z() - Other.Z()
274 Subtracted (me; Right : XYZ) returns XYZ is static;
276 ---C++: alias operator -
278 -- new.X() = <me>.X() - Other.X()
279 -- new.Y() = <me>.Y() - Other.Y()
280 -- new.Z() = <me>.Z() - Other.Z()
282 SetLinearForm (me : in out;
283 A1 : Real; XYZ1 : XYZ; A2 : Real; XYZ2 : XYZ;
284 A3 : Real; XYZ3 : XYZ; XYZ4 : XYZ)
287 -- <me> is set to the following linear form :
288 -- A1 * XYZ1 + A2 * XYZ2 + A3 * XYZ3 + XYZ4
291 SetLinearForm (me : in out;
292 A1 : Real; XYZ1 : XYZ; A2 : Real; XYZ2 : XYZ;
293 A3 : Real; XYZ3 : XYZ)
296 -- <me> is set to the following linear form :
297 -- A1 * XYZ1 + A2 * XYZ2 + A3 * XYZ3
300 SetLinearForm (me : in out;
301 A1 : Real; XYZ1 : XYZ; A2 : Real; XYZ2 : XYZ; XYZ3 : XYZ)
304 -- <me> is set to the following linear form :
305 -- A1 * XYZ1 + A2 * XYZ2 + XYZ3
308 SetLinearForm (me : in out; A1 : Real; XYZ1 : XYZ; A2 : Real; XYZ2 : XYZ)
311 -- <me> is set to the following linear form :
312 -- A1 * XYZ1 + A2 * XYZ2
315 SetLinearForm (me : in out; A1 : Real; XYZ1 : XYZ; XYZ2 : XYZ)
318 -- <me> is set to the following linear form :
322 SetLinearForm (me : in out; XYZ1, XYZ2 : XYZ) is static;
324 -- <me> is set to the following linear form :