Skip to main content

Calculate quaternion with rotation matrix.

Project description

rotmat_to_quaternion

Calculate quaternion with rotation matrix.

Installation

pip install rotmat_to_quaternion

Usage

from rotmat_to_quaternion import quaternion_to_rotation_matrix
from rotmat_to_quaternion import rotation_matrix_to_quaternion
import math

# Test quaternion: 90° rotation around Z-axis
q = [math.sqrt(2)/2, 0.0, 0.0, math.sqrt(2)/2]
print("Original quaternion [w,x,y,z]:")
print([round(v, 6) for v in q])

# Convert to rotation matrix
mat = quaternion_to_rotation_matrix(q)
print("\nQuaternion -> Rotation Matrix:")
for row in mat:
    print([round(v, 6) for v in row])

# Convert back to quaternion
q_recovered = rotation_matrix_to_quaternion(mat)
print("\nRotation Matrix -> Quaternion [w,x,y,z]:")
print([round(v, 6) for v in q_recovered])

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

rotmat_to_quaternion-0.1.0.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

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

rotmat_to_quaternion-0.1.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file rotmat_to_quaternion-0.1.0.tar.gz.

File metadata

  • Download URL: rotmat_to_quaternion-0.1.0.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.13.12 Windows/11

File hashes

Hashes for rotmat_to_quaternion-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a85853c907608e5e81251acd357058e108b8a8628dd4800f039df829fc397e50
MD5 493dc5615d1f5b937415bb2a0fea3897
BLAKE2b-256 8119dfd096ebcdb185d6df34b5931881df7df01f9e5f7ad4fd83113cdddf0904

See more details on using hashes here.

File details

Details for the file rotmat_to_quaternion-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for rotmat_to_quaternion-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee06de0759de722caa1044ab9c9d4d3c2fbf80c7a4212621f660ca691e412369
MD5 424b9a35b5023262e165b2e40e9be9fa
BLAKE2b-256 e3886d7aef4cc82c5b7ffe4101fc9441b3bbd5862d233b9d3f7322417f643004

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