rotate_vector#
- Quaternion.rotate_vector(v)#
Evaluate the rotation of a vector, defined by a quaternion.
Evaluated as:
"q = q0 + q' = q0 + q1i + q2j + q3k"
,"w = qvq* = (q0^2 - |q'|^2)v + 2(q' • v)q' + 2q0(q' x v)"
.- Parameters:
- v
tuple
orList
(x, y, z)
coordinates for the vector to be rotated.
- v
- Returns:
tuple
(w1, w2, w3)
coordinates for the rotated vectorw
.
Examples
>>> from ansys.aedt.core.generic.quaternion import Quaternion >>> q = Quaternion(0.9238795325112867, 0.0, -0.3826834323650898, 0.0) >>> v = (1, 0, 0) >>> q.rotate_vector(v) (0.7071067811865475, 0.0, 0.7071067811865476)