Skip to main content

Perform quaternion operations using numpy arrays

Project description

README

ReadTheDocs Status CircleCI Codecov PyPI Codacy Badge PyPI - Python Version

The rowan package provides a simple and consistent interface for using quaternions. The package is built entirely on top of numpy and represents quaternions using numpy arrays, meaning that all functions support arbitrarily high-dimensional arrays of quaternions. Quaternions are encoded as arrays of shape (...,4), with the convention that the final dimension of an array (a, b, c, d) represents the quaternion a + bi + cj + dk. The package covers all basic quaternion algebraic and calculus operations, and also provides features for measuring distances, performing point cloud mapping, and interpolating.

Authors

Setup

The recommended method for installing rowan is using pip.

Installation via pip

To install the package from PyPI, execute:

pip install rowan --user

Installation from source

To install from source, execute:

git clone https://bitbucket.org/vramasub/rowan.git
cd rowan
python setup.py install --user

Requirements

  • Python = 2.7, >= 3.3
  • Numpy >= 1.10

Testing

The package is currently tested for python versions 2.7, 3.3, 3.4, 3.5, 3.6, and 3.7 on Unix. Continuous integrated testing is performed using CircleCI on these python versions with numpy versions 1.10 and above.

To run the packaged unit tests, execute:

python -m unittest discover tests

To check test coverage, make sure the coverage module is installed:

pip install coverage

and then run the packaged unit tests:

coverage run -m unittest discover tests

Quickstart

This library can be used to work with quaternions by simply instantiating the appropriate numpy arrays and passing them to the required functions. For example:

>>> import rowan
>>> one = np.array([10, 0, 0, 0])
>>> one_unit = rowan.normalize(one)
>>> assert(one_unit == np.array([1, 0, 0, 0]))
>>> if not one_unit == rowan.quat_multiply(one_unit, one_unit):
>>>     raise RuntimeError("Multiplication failed!")
>>>
>>> one_vec = np.array([1, 0, 0])
>>> rotated_vector = rowan.rotate(one_unit, one_vec)
>>>
>>> import numpy as np
>>> mat = np.eye(3)
>>> quat_rotate = rowan.from_matrix(mat)
>>> alpha, beta, gamma = rowan.to_euler(quat_rotate)
>>> quat_rotate_returned = rowan.from_euler(alpha, beta, gamma)
>>> identity = rowan.to_matrix(quat_rotate_returned)

Documentation

Documentation for rowan is written in reStructuredText and compiled using Sphinx. To build the documentation, first install Sphinx:

pip install sphinx

You can then use sphinx to create the actual documentation in either pdf or HTML form by running the following commands in the rowan root directory:

cd doc
make html # For html output
make latexpdf # For a LaTeX compiled PDF file
open build/html/index.html

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

rowan-0.6.1.1.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

rowan-0.6.1.1-py2.py3-none-any.whl (22.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file rowan-0.6.1.1.tar.gz.

File metadata

  • Download URL: rowan-0.6.1.1.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for rowan-0.6.1.1.tar.gz
Algorithm Hash digest
SHA256 28dbcd607e302fa9e147f6a065a936c57c742e01bbce4c52e920497fd477fc6f
MD5 a81120e5110be8aa1cbb9bfa4b5a4815
BLAKE2b-256 c2d278d85997079219c8ec17ae835d849e0aa09d2441ad39368ac4f94416f268

See more details on using hashes here.

File details

Details for the file rowan-0.6.1.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for rowan-0.6.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ce7910e5190928b4f9f70b78c0a8a4308b0740fd0ea04e8b05baf907a13f6b68
MD5 6a99c46834ce8c392bdd2db0dfef987e
BLAKE2b-256 2548d837a906b14dff918f3de9892266ddb14a6cd484939b65224989a7916c7b

See more details on using hashes here.

Supported by

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