Giter Club home page Giter Club logo

3d-quaternions's Introduction

## About 3d-quaternions
This is a library for quaternions. It contains most of the quaternion operations one would usually expect out of such a library and offers them both in non-modifying and modifying versions where applicable. It also tries to be efficient where plausible. Each quaternion is made up of ``float``s, which by default are ``single-float``s, as they do not require value boxing on most modern systems and compilers.

## How To
Load it through ASDF or Quicklisp

::
(ql:quickload :3d-quaternions)
(use-package :org.shirakumo.flare.quaternion)
::

Create a quaternion:

::
(quat)
::

Quaternions always use ``float``s. Where sensible, operations should accept ``real`` numbers for convenience. All quaternion operations are prefixed with a ``q`` to allow importing the package without conflicts. 

::
(q+ (quat 1 2 3 4) 4 5 6)
(qfrom-angle +vz+ PI)
::

3d-quaternions implements pretty much all quaternion operations you might need, including comparators, dot product, matrix conversion, and so forth. There's also modifying variants of most operators, which have the same name, except they are prefixed by an ``n``.

::
(let ((q (quat)))
  (nq* (nq+ q (quat 1 2 3 4)) 3)
  q)
::

``quat``s are dumpable, meaning you can insert them as literals into your code and they will be properly saved to and restored from a FASL.

If you require higher precision than ``single-float``s ensure, you can add ``:3d-vectors-double-floats`` to ``*features*`` and recompile the library ``(asdf:compile-system :3d-quaternions :force T)``. Similarly, if you want to switch back to ``single-float``s, you can remove the feature and recompile. Both at the same time is not supported as it would increase complexity in the library massively and make certain operations much slower.

## Also See
- "3d-vectors"(https://shinmera.github.io/3d-vectors) for Vector operations in conjunction with this library.
- "3d-matrices"(https://shinmera.github.io/3d-matrices) for Matrix operations in conjunction with this library.

3d-quaternions's People

Contributors

shinmera avatar

Watchers

James Cloos 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.