MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / rotate

Method rotate

python/pymesh/misc/quaternion.py:160–172  ·  view source on GitHub ↗

Rotate 3D vector v by this quaternion Args: ``v`` (``numpy.ndarray``): Must be 1D vector. Returns: The rotated vector.

(self, v)

Source from the content-addressed store, hash-verified

158 ])
159
160 def rotate(self, v):
161 """ Rotate 3D vector v by this quaternion
162
163 Args:
164 ``v`` (``numpy.ndarray``): Must be 1D vector.
165
166 Returns:
167 The rotated vector.
168 """
169 m = norm(v)
170 v = Quaternion([0, v[0], v[1], v[2]])
171 r = self * v * self.conjugate()
172 return r[1:4] * m
173
174 @property
175 def w(self):

Callers

nothing calls this directly

Calls 2

conjugateMethod · 0.95
QuaternionClass · 0.85

Tested by

no test coverage detected