Giter Site home page Giter Site logo

purescript-quaternions's Introduction

purescript-quaternions

Quaternions are a generalization of complex numbers, which turn out to have a few applications in computing.

This library provides a Quaternion data type and some functions for manipulating them, together with another type for using them to represent rotations in 3D space.

Documentation is on Pursuit.

purescript-quaternions's People

Contributors

gerstacker avatar hdgarrood avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

gerstacker

purescript-quaternions's Issues

Add support for SLERP

Great library! I think it would be great to add support for spherical linear interpolation (SLERP) which is quite natural with a presentation in terms of quaternions.

pulp test shirks tests

This doesn't feel like a purescript-quaternions problem, more likely lower level. But this is where I've made a test case. Please look at the tip of master in https://github.com/Gerstacker/purescript-quaternions.git
For the tip commit bb29be, "pulp test" reliably produces "Tests OK." with no evidence that it's actually run any tests. The only changes are import specifications and type annotations to fix compiler warnings.
Rolling back to the previous commit 4bfcdb, output is as expected. Rolling forward again, same failure.

pulp version 11.0.2
purs version 0.11.6

If I'm missing something dumb, please say so!

Should toMat4 actually return a 3x3 matrix?

cc @Gerstacker

I've decided to drop the purescript-matrix and purescript-vector dependencies because they do not seem to be being kept up-to-date, and because there doesn't (yet) seem to be a standard linear algebra library for purescript. Now Data.Quaternion.Rotation.toMat4 just produces an array in row-major order, which means that all you have to do is call Mat4.mat4 on the result to get back the previous behaviour.

In the process of doing this, however, I realised that toMat4 is not very well documented, and also I'm not entirely sure what it actually represents. Unit quaternions represent rotations in 3 dimensions, so if we are providing a function which converts a quaternion to a rotation matrix, wouldn't it make sense to have it produce a 3x3 matrix rather than a 4x4 one? Especially since the current implementation is essentially gives you a 3x3 matrix, since it doesn't do anything to the fourth element when applied to an element of R^4. In fact the current implementation seems to be doing the same thing as in this Wikipedia article: https://en.wikipedia.org/wiki/Rotation_formalisms_in_three_dimensions#Rotation_matrix_.E2.86.94_quaternion

Add rotationFromTo

Inspired by Irrlicht; a function rotationFromTo :: Vec3 Number -> Vec3 Number -> Rotation would be nice to have.

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.