Debian Codegraph @

src/Base/Rotation.pyi

raw
1 # SPDX-License-Identifier: LGPL-2.1-or-later
2
3 from Metadata import export, constmethod, class_declarations
4 from PyObjectBase import PyObjectBase
5 from Vector import Vector
6 from Matrix import Matrix
7 from typing import overload, Tuple, List, Final
8
9 @export(
10 Constructor=True,
11 Delete=True,
12 NumberProtocol=True,
13 RichCompare=True,
14 )
15 @class_declarations(
16 """public:
17 RotationPy(const Rotation & mat, PyTypeObject *T = &Type)
18 :PyObjectBase(new Rotation(mat),T){}
19 Rotation value() const
20 { return *(getRotationPtr()); }
21 """
22 )
23 class Rotation(PyObjectBase):
24 """
25 Base.Rotation class.
26
27 A Rotation using a quaternion.
28
29 The following constructors are supported:
30
31 Rotation()
32 Empty constructor.
33
34 Rotation(rotation)
35 Copy constructor.
36
37 Rotation(Axis, Radian)
38 Rotation(Axis, Degree)
39 Define from an axis and an angle (in radians or degrees according to the keyword).
40 Axis : Base.Vector
41 Radian : float
42 Degree : float
43
44 Rotation(vector_start, vector_end)
45 Define from two vectors (rotation from/to vector).
46 vector_start : Base.Vector
47 vector_end : Base.Vector
48
49 Rotation(angle1, angle2, angle3)
50 Define from three floats (Euler angles) as yaw-pitch-roll in XY'Z'' convention.
51 angle1 : float
52 angle2 : float
53 angle3 : float
54
55 Rotation(seq, angle1, angle2, angle3)
56 Define from one string and three floats (Euler angles) as Euler rotation
57 of a given type. Call toEulerAngles() for supported sequence types.
58 seq : str
59 angle1 : float
60 angle2 : float
61 angle3 : float
62
63 Rotation(x, y, z, w)
64 Define from four floats (quaternion) where the quaternion is specified as:
65 q = xi+yj+zk+w, i.e. the last parameter is the real part.
66 x : float
67 y : float
68 z : float
69 w : float
70
71 Rotation(dir1, dir2, dir3, seq)
72 Define from three vectors that define rotated axes directions plus an optional
73 3-characher string of capital letters 'X', 'Y', 'Z' that sets the order of
74 importance of the axes (e.g., 'ZXY' means z direction is followed strictly,
75 x is used but corrected if necessary, y is ignored).
76 dir1 : Base.Vector
77 dir2 : Base.Vector
78 dir3 : Base.Vector
79 seq : str
80
81 Rotation(matrix)
82 Define from a matrix rotation in the 4D representation.
83 matrix : Base.Matrix
84
85 Rotation(*coef)
86 Define from 16 or 9 elements which represent the rotation in the 4D matrix
87 representation or in the 3D matrix representation, respectively.
88 coef : sequence of float
89
90 Author: Juergen Riegel ([email protected])
91 Licence: LGPL
92 """
93
94 Q: Tuple[float, ...] = ()
95 """The rotation elements (as quaternion)."""
96
97 Axis: object = None
98 """The rotation axis of the quaternion."""
99
100 RawAxis: Final[object] = None
101 """The rotation axis without normalization."""
102
103 Angle: float = 0.0
104 """The rotation angle of the quaternion."""
105
106 # TODO: Provide strongly-typed enum for `seq`
107 # fmt: off
108 @overload
109 def __init__(self) -> None: ...
110 @overload
111 def __init__(self, rotation: "Rotation") -> None: ...
112 @overload
113 def __init__(self, axis: Vector, angle: float) -> None: ...
114 @overload
115 def __init__(self, vector_start: Vector, vector_end: Vector) -> None: ...
116 @overload
117 def __init__(self, angle1: float, angle2: float, angle3: float) -> None: ...
118 @overload
119 def __init__(self, seq: str, angle1: float, angle2: float, angle3: float) -> None: ...
120 @overload
121 def __init__(self, x: float, y: float, z: float, w: float) -> None: ...
122 @overload
123 def __init__(self, dir1: Vector, dir2: Vector, dir3: Vector, seq: str) -> None: ...
124 @overload
125 def __init__(self, matrix: Matrix) -> None: ...
126 @overload
127 def __init__(self, *coef: float) -> None: ...
128 # fmt: on
129
130 def invert(self) -> None:
131 """
132 invert() -> None
133
134 Sets the rotation to its inverse.
135 """
136 ...
137
138 @constmethod
139 def inverted(self) -> "Rotation":
140 """
141 inverted() -> Base.Rotation
142
143 Returns the inverse of the rotation.
144 """
145 ...
146
147 def isSame(self, rotation: "Rotation", tol: float = 0) -> bool:
148 """
149 isSame(rotation, tol=0) -> bool
150
151 Checks if `rotation` perform the same transformation as this rotation.
152
153 rotation : Base.Rotation
154 tol : float
155 Tolerance used to compare both rotations.
156 If tol is negative or zero, no tolerance is used.
157 """
158 ...
159
160 @constmethod
161 def multiply(self, rotation: "Rotation") -> "Rotation":
162 """
163 multiply(rotation) -> Base.Rotation
164
165 Right multiply this rotation with another rotation.
166
167 rotation : Base.Rotation
168 Rotation by which to multiply this rotation.
169 """
170 ...
171
172 @constmethod
173 def multVec(self, vector: Vector) -> Vector:
174 """
175 multVec(vector) -> Base.Vector
176
177 Compute the transformed vector using the rotation.
178
179 vector : Base.Vector
180 Vector to be transformed.
181 """
182 ...
183
184 @constmethod
185 def slerp(self, rotation2: "Rotation", t: float) -> "Rotation":
186 """
187 slerp(rotation2, t) -> Base.Rotation
188
189 Spherical Linear Interpolation (SLERP) of this rotation and `rotation2`.
190
191 t : float
192 Parameter of the path. t=0 returns this rotation, t=1 returns `rotation2`.
193 """
194 ...
195
196 def setYawPitchRoll(self, angle1: float, angle2: float, angle3: float) -> None:
197 """
198 setYawPitchRoll(angle1, angle2, angle3) -> None
199
200 Set the Euler angles of this rotation as yaw-pitch-roll in XY'Z'' convention.
201
202 angle1 : float
203 Angle around yaw axis in degrees.
204 angle2 : float
205 Angle around pitch axis in degrees.
206 angle3 : float
207 Angle around roll axis in degrees.
208 """
209 ...
210
211 @constmethod
212 def getYawPitchRoll(self) -> Tuple[float, float, float]:
213 """
214 getYawPitchRoll() -> tuple
215
216 Get the Euler angles of this rotation as yaw-pitch-roll in XY'Z'' convention.
217 The angles are given in degrees.
218 """
219 ...
220
221 def setEulerAngles(self, seq: str, angle1: float, angle2: float, angle3: float) -> None:
222 """
223 setEulerAngles(seq, angle1, angle2, angle3) -> None
224
225 Set the Euler angles in a given sequence for this rotation.
226 The angles must be given in degrees.
227
228 seq : str
229 Euler sequence name. All possible values given by toEulerAngles().
230 angle1 : float
231 angle2 : float
232 angle3 : float
233 """
234 ...
235
236 @constmethod
237 def toEulerAngles(self, seq: str = "") -> List[float]:
238 """
239 toEulerAngles(seq) -> list
240
241 Get the Euler angles in a given sequence for this rotation.
242
243 seq : str
244 Euler sequence name. If not given, the function returns
245 all possible values of `seq`. Optional.
246 """
247 ...
248
249 @constmethod
250 def toMatrix(self) -> Matrix:
251 """
252 toMatrix() -> Base.Matrix
253
254 Convert the rotation to a 4D matrix representation.
255 """
256 ...
257
258 @constmethod
259 def isNull(self) -> bool:
260 """
261 isNull() -> bool
262
263 Returns True if all values in the quaternion representation are zero.
264 """
265 ...
266
267 @constmethod
268 def isIdentity(self, tol: float = 0) -> bool:
269 """
270 isIdentity(tol=0) -> bool
271
272 Returns True if the rotation equals the 4D identity matrix.
273 tol : float
274 Tolerance used to check for identity.
275 If tol is negative or zero, no tolerance is used.
276 """
277 ...