MCPcopy Create free account
hub / github.com/d62lu/3DCTN / angle_axis2euler

Function angle_axis2euler

visualizer/eulerangles.py:327–359  ·  view source on GitHub ↗

Convert angle, axis pair to Euler angles Parameters ---------- theta : scalar angle of rotation vector : 3 element sequence vector specifying axis for rotation. is_normalized : bool, optional True if vector is already normalized (has norm of 1). Default

(theta, vector, is_normalized=False)

Source from the content-addressed store, hash-verified

325
326
327def angle_axis2euler(theta, vector, is_normalized=False):
328 ''' Convert angle, axis pair to Euler angles
329 Parameters
330 ----------
331 theta : scalar
332 angle of rotation
333 vector : 3 element sequence
334 vector specifying axis for rotation.
335 is_normalized : bool, optional
336 True if vector is already normalized (has norm of 1). Default
337 False
338 Returns
339 -------
340 z : scalar
341 y : scalar
342 x : scalar
343 Rotations in radians around z, y, x axes, respectively
344 Examples
345 --------
346 >>> z, y, x = angle_axis2euler(0, [1, 0, 0])
347 >>> np.allclose((z, y, x), 0)
348 True
349 Notes
350 -----
351 It's possible to reduce the amount of calculation a little, by
352 combining parts of the ``angle_axis2mat`` and ``mat2euler``
353 functions, but the reduction in computation is small, and the code
354 repetition is large.
355 '''
356 # delayed import to avoid cyclic dependencies
357 import nibabel.quaternions as nq
358 M = nq.angle_axis2mat(theta, vector, is_normalized)
359 return mat2euler(M)

Callers

nothing calls this directly

Calls 1

mat2eulerFunction · 0.85

Tested by

no test coverage detected