Return angle, axis corresponding to these Euler angles Uses the z, then y, then x convention above Parameters ---------- z : scalar Rotation angle in radians around z-axis (performed first) y : scalar Rotation angle in radians around y-axis x : scalar Ro
(z=0, y=0, x=0)
| 295 | |
| 296 | |
| 297 | def euler2angle_axis(z=0, y=0, x=0): |
| 298 | ''' Return angle, axis corresponding to these Euler angles |
| 299 | Uses the z, then y, then x convention above |
| 300 | Parameters |
| 301 | ---------- |
| 302 | z : scalar |
| 303 | Rotation angle in radians around z-axis (performed first) |
| 304 | y : scalar |
| 305 | Rotation angle in radians around y-axis |
| 306 | x : scalar |
| 307 | Rotation angle in radians around x-axis (performed last) |
| 308 | Returns |
| 309 | ------- |
| 310 | theta : scalar |
| 311 | angle of rotation |
| 312 | vector : array shape (3,) |
| 313 | axis around which rotation occurs |
| 314 | Examples |
| 315 | -------- |
| 316 | >>> theta, vec = euler2angle_axis(0, 1.5, 0) |
| 317 | >>> print(theta) |
| 318 | 1.5 |
| 319 | >>> np.allclose(vec, [0, 1, 0]) |
| 320 | True |
| 321 | ''' |
| 322 | # delayed import to avoid cyclic dependencies |
| 323 | import nibabel.quaternions as nq |
| 324 | return nq.quat2angle_axis(euler2quat(z, y, x)) |
| 325 | |
| 326 | |
| 327 | def angle_axis2euler(theta, vector, is_normalized=False): |
nothing calls this directly
no test coverage detected