Coder Social home page Coder Social logo

jasonkhadka / quaternions Goto Github PK

View Code? Open in Web Editor NEW

This project forked from moble/quaternions

0.0 2.0 0.0 896 KB

Quaternion library for C++, with python bindings via SWIG.

License: MIT License

C++ 13.27% Makefile 0.35% C 9.43% Python 0.52% Jupyter Notebook 76.42%

quaternions's Introduction

Quaternions

Quaternion library for C++, with python bindings via SWIG.

This code provides a simple class for calculating easily with quaternions. Operator overloads are provided for all the basic operations such as addition, multiplication, etc. The standard functions like exp and log (which are what make quaternions so uniquely powerful) are also available.

Additionally, support is included for time series of quaternions, as well as operations such as differentiation, interpolation (linear and quadratic). Several algorithms also provide capabilities for finding the minimal-rotation frame that tracks a certain vector, or finds the frame that has a particular angular velocity.

Compiling with other code

This main library is fairly simple, and should be trivial to compile; only the header Quaternions.hpp needs to be included, and only the file Quaternions.cpp needs to be compiled.

The second pair of files, IntegrateAngularVelocity.{c,h}pp contain just two functions, but depend on the GNU Scientific Library (GSL) for interpolation and ODE integration. So GSL must be installed separately, compiled as a shared library, and the -I and -L flags variables set appropriately on whatever compilation is done.

An example of how to use this code as a library in other code (and a working Makefile) is given in the tests directory.

For python, compilation is done automatically, and assumes the presence of GSL. However, if desired, this dependency can be removed by using the flag --no-GSL when compiling the python module.

Installing the python module

Though this code can be included as a library in other code, it can also be used on its own as a python module. Just run

python setup.py install --user

The --user flag installs the module to the user's home directory, which means that no root permissions are necessary.

As mentioned above, GSL is assumed to be installed as a shared library, and the IncDirs and LibDirs variables set appropriately in setup.py. Sensible defaults are given, so this may only need to be done if the compilation fails. If GSL is not installed, you can still build most of this module by using

python setup.py install --user --no-GSL

If the build succeeds, just open an python session and type

import Quaternions

In ipython, you can then see your options using tab completion by typing

Quaternions.

and then hitting tab. Help is available on many functions in ipython by typing a question mark after the function name. For example:

Quaternions.Squad?

In plain python, the same thing can be achieved by entering help(Quaternions.Squad). But if you're using plain python interactively, you should really give ipython a try.

quaternions's People

Contributors

moble avatar

Watchers

James Cloos avatar jason avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.