David Briscoe aec3b9fd7f Prevent nan when using color_to_hsv(white)
When r,g,b are equal, delta will be zero and hue will be nan due to
divide by zero.

This is also an issue with the reference C++ code:
https://tio.run/##Sy4o0E3OScxL//9fOTMvOac0JVXBJjO/uKQoNTHXjiszr0QhNzEzT0NToZqLs7gkxcoqOb@0RMHGRkHJIzUnJ19HITy/KCdFUQkkBJZPzUvJseaq/f8fAA

An alternative approach is to always add epsilon or use a different hue
calculation:
    http://web.archive.org/web/20210515082154/http://lolengine.net/blog/2013/01/13/fast-rgb-to-hsv
2022-04-01 21:55:32 -07:00
2021-06-23 16:28:47 -07:00
2021-06-23 14:33:46 -07:00
2022-04-01 21:47:56 -07:00
2016-07-24 05:27:55 -03:00
2021-06-23 14:33:46 -07:00
2019-11-01 01:02:03 +01:00
2022-03-27 01:11:29 -07:00

Cirno's Perfect Math Library

Build Status Coverage Status

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
No description provided
Readme 637 KiB
Languages
Lua 100%