Skip to main content

A package to handle rotation in 3D space with pytorch and numpy

Project description

pyrotation

Interconversion of Euler angles, axis angles, quaternions, and rotation matrix. Supports numpy.ndarray and torch.Tensor, and uses plum-dispatch to decorate functions of the same name. In addition, it supports arbitrary shapes.

Installation

pip install pyrotation

conversion

we use plum-dispatch to decorate functions of the same name, so you can use pyrotation.conversion to convert between different representations. We support numpy.ndarray and torch.Tensor, and the input can be of arbitrary shape.

quaternion matrix euler_angle axis_angle
quaternion - quaternion_from_matrix quaternion_from_euler_angle quaternion_from_axis_angle
matrix matrix_from_quaternion - matrix_from_euler_angle matrix_from_axis_angle
euler_angle euler_angle_from_quaternion euler_angle_from_matrix - euler_angle_from_axis_angle
axis_angle axis_angle_from_quaternion axis_angle_from_matrix axis_angle_from_euler_angle -
import torch
from pyrotation.conversion import quaternion_from_matrix, euler_angle_from_matrix

# convert a 10x3x3 rotation matrix to a quaternion
R = torch.rand(10, 3, 3)
quat = quaternion_from_matrix(R)
euler_angle = euler_angle_from_matrix(R)

print(quat.shape) # torch.Size([10, 4])
print(euler_angle.shape) # torch.Size([10, 3])

We also support conversions between so3 and SO3, se3 and SE3. You can use SO3_from_so3 and SE3_from_se3 to convert so3 and se3 to SO3 and SE3, respectively. Similarly, you can use so3_from_SO3 and se3_from_SE3 to convert SO3 and SE3 to so3 and se3, respectively.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyrotation-0.0.2.tar.gz (22.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyrotation-0.0.2-py2.py3-none-any.whl (22.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pyrotation-0.0.2.tar.gz.

File metadata

  • Download URL: pyrotation-0.0.2.tar.gz
  • Upload date:
  • Size: 22.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for pyrotation-0.0.2.tar.gz
Algorithm Hash digest
SHA256 270cab114d0f80bc621c6f1fba115a8be61ac5f4abf9f27c571c81f1f5f55c90
MD5 27d6f925dea2331def0b57dfc02def8a
BLAKE2b-256 ba7579ef8c8f0b962b340f457e021ab3f6696d7f93dabab6f73d74ae213aa124

See more details on using hashes here.

File details

Details for the file pyrotation-0.0.2-py2.py3-none-any.whl.

File metadata

  • Download URL: pyrotation-0.0.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 22.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for pyrotation-0.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2da5706c9511d210a74076b2a7b6d7cdcf15c939323d29ca192bdfe712387935
MD5 6fcf291fc4a204df02f20297ba725375
BLAKE2b-256 d3efb71601d4c203aa87b43201bfb4fab68733ce242c62df4ce8acc5e9d3d811

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page