Our hsv logic assumes 0-1 (cs.rit.edu says "r,g,b values are from 0 to 1") and it makes more sense to provide __mul for multiplying in 0-1 since the result will stay in that range. Additionally, love switched to 0-1 color since 11.0. Included an as_255() function to unpack the color in 0-255 for some amount of backwards compatibility. Doesn't make sense to provide any kind of color object for it since most of our functions won't work correctly. Add tests for hue(), saturation(), value() that fail (even with /255 removed) for the old code, but pass on the new 0-1 range because the hsv logic outputs colors in 0-1. Test comparisons use reduced precision because my input data has limited precision.
Cirno's Perfect Math Library
Various useful bits of game math. 3D line intersections, ray casting, 2d/3d vectors, 4x4 matrices, quaternions, etc.
Intended to be used with LuaJIT and LÖVE (this is the backbone of LÖVE3D).
Online documentation can be found here or you can generate them yourself using ldoc -c doc/config.ld -o index .
Installation
Clone the repository and require it, or if you prefer luarocks: $ luarocks install --server=http://luarocks.org/dev cpml
. Add --tree=whatever
for a local install.
Versions
This library has a major compatibility break at version 1.0. Up to version 0.10, composition ab means "apply b, then a" for quaternions and "apply a, then b" for matrices. Now as of version 1.0, the two are consistent and matrix ab means "apply b, then a".
Description
Languages
Lua
100%