Graphmath is a library for handling common 2D and 3D operations, usually with an eye towards vector arithmetic for graphics and simulation.
It's designed to be comfortable to use, reasonably fast, and something which will benefit game developers and graphics programmers, though it may also be useful for robotocists and anyone attempting large-scale simluations which exist in R2 or R3.
- Support for vectors in R2 and R3.
- Support for 3x3 and 4x4 matrices.
- Support for quaternions
- Addition, subtraction
- Element-wise multiplication
- Scalar multiplication
- Inner-products (dot product)
- Cross products
- Projection
- Normalization
- Comparison
- Rotation
- Linear interpolation
- Matrix inversion
- Tuples are used to represent vectors and matrices (faster than lists or structs)
This package is available from the hex package manager.
Just add it to your mix.exs
file like so:
def project do
[app: myapp,
version: "x.y.z",
elixir: "~> 1.0",
description: "description",
package: ...,
deps: [
...,
{:graphmath, "~> 1.0.2" },
...
] ]
end
All mathematics are done in a right-handed coordinate system--that is to say, +Z is the cross-product of +X with +Y.
All operations are accompanied by tests and documentation.
- Open an issue on Github.
-
Fork this project on Github.
-
Open an issue for your proposed changes.
-
Add tests for your new functionality, if applicable.
-
Add documentation for your functionality, if applicable. NO DOCS -> NO MERGE.
-
Submit a pull request.
-
Bask in the glory of having helped create content on one of the best platforms ever devised.
- Buy me a beer if you see me at ElixirConf.
-
C/SIMD native extensions (probably want to live in a different, API-compatible library).
-
Left-handed coordinate system support (don't care enough right now, but some interop would appreciate it).
-
Functions to convert to packed 32-bit and 64-bit float byte arrays.
This project is put into the public domain under the unlicense.
If you can't use that, consider it under the WTFPL.
If you can't use that, fine--use the new BSD license.
- Chris Ertel
- Ivan Miranda
- Matthew Philyaw