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)
| 379 | |
| 380 | |
| 381 | def angle_axis2euler(theta, vector, is_normalized=False): |
| 382 | ''' Convert angle, axis pair to Euler angles |
| 383 | |
| 384 | Parameters |
| 385 | ---------- |
| 386 | theta : scalar |
| 387 | angle of rotation |
| 388 | vector : 3 element sequence |
| 389 | vector specifying axis for rotation. |
| 390 | is_normalized : bool, optional |
| 391 | True if vector is already normalized (has norm of 1). Default |
| 392 | False |
| 393 | |
| 394 | Returns |
| 395 | ------- |
| 396 | z : scalar |
| 397 | y : scalar |
| 398 | x : scalar |
| 399 | Rotations in radians around z, y, x axes, respectively |
| 400 | |
| 401 | Examples |
| 402 | -------- |
| 403 | >>> z, y, x = angle_axis2euler(0, [1, 0, 0]) |
| 404 | >>> np.allclose((z, y, x), 0) |
| 405 | True |
| 406 | |
| 407 | Notes |
| 408 | ----- |
| 409 | It's possible to reduce the amount of calculation a little, by |
| 410 | combining parts of the ``angle_axis2mat`` and ``mat2euler`` |
| 411 | functions, but the reduction in computation is small, and the code |
| 412 | repetition is large. |
| 413 | ''' |
| 414 | # delayed import to avoid cyclic dependencies |
| 415 | import nibabel.quaternions as nq |
| 416 | M = nq.angle_axis2mat(theta, vector, is_normalized) |
| 417 | return mat2euler(M) |
| 418 | |
| 419 | def pose2T(pose): |
| 420 | import nibabel.quaternions as nq |
nothing calls this directly
no test coverage detected