52 Commits

Author SHA1 Message Date
David Briscoe
29954aa60e vec: Add nan checking functions
Add:
* vec2.has_nan + test
* vec3.has_nan + test
* quat.has_nan
* mat4.has_nan
* utils.is_nan + test
2022-03-26 23:33:13 -07:00
mcclure
1000f1d6e5
Merge pull request #48 from mcclure/mat4-reverse
Consistency: mat4 multiply in wrong order
2020-05-03 13:13:11 -04:00
mcclure
5601094c04
Merge pull request #49 from mcclure/vec4_cols
Column version of to_vec4s (to_vec4s_cols)
2020-05-03 12:37:22 -04:00
mcc
13cc666232 Column version of to_vec4s (to_vec4s_cols) for issue #32 2019-11-29 22:24:47 -05:00
mcc
d51a930e4a Consistency (issue #33): mat4 multiply in wrong order
This is a breaking change.
2019-11-29 22:12:22 -05:00
mcc
a86935a39b Allow ffi.metatype to fail so that "busted" unit tests work
On Github we run unit tests inside "busted". At the start of each test "busted" does some sort of trick (clearing package.loaded)? Which causes "require" to run again for all lua files. This breaks ffi.metatype with error "cannot change a protected metatable" if it is called twice with a single type name, since this is true global state. To work around this this patch wraps ffi.metatype calls in a xpcall() so that failure is silently ignored.
2019-11-29 21:13:30 -05:00
mcc
7fa1785469 Fix failing tests; this involves changing 2 bad tests and 1 bad behavior:
- vec2 to_polar/from_cartesian tests were testing for equality rather than using an epsilon.
- bound2.contains had two tests that were plain wrong.
- While I'm fixing the bounds test, bound2.contains and bound3.contains probably ought to test their own min and max values for inclusion.
- The implementation of mat4.look_at appears to be wrong. The final column was being set to 0,0,0,1 which comparing against other implementations does not seem to be correct. My replacement code is modeled on the method used in mat4x4_look_at() in linmath.h in GLFW, which says it's a reimplementation on the method from gluLookAt(). With this change the test passes as originally written.
2019-11-29 17:16:20 -05:00
bjorn
2ac5321bdf mat4:reflect; 2018-01-05 22:08:11 -08:00
Colby Klein
5f9fa96e10 fix typo 2017-11-17 09:52:58 -08:00
Colby Klein
24bcae96e3 probably fix look_at 2017-11-17 09:48:22 -08:00
Colby Klein
b122e4d726 fix typo 2017-03-29 05:32:16 -07:00
Colby Klein
3a18ed0f8c temporarily revert mat4.lua due to bugs 2016-12-22 11:17:58 -08:00
Colby Klein
736ef2fcf8 fix doc comment for mat4.look_at 2016-12-15 16:44:09 -08:00
karai17
08b23e394b Updated tests, fixed couple bugs 2016-12-15 19:57:31 -04:00
karai17
a7f9247838 Unfactored the rest of cpml. Completely untested (all tests are broken) 2016-12-15 04:34:46 -04:00
Colby Klein
ff7cc186e7 add mat4 * vec3 (implicit w=1) 2016-12-13 15:09:38 -08:00
karai17
799e1607bc Updated to work outside of a sanitized environment. 2016-08-14 03:36:36 -03:00
karai17
dc31605db6 Fixed mat4.look_at 2016-07-24 23:42:44 -03:00
karai17
ebae3a1fce Updated mat4 LDocs 2016-07-24 22:16:04 -03:00
karai17
6daa845533 No unnecessary lines! 2016-07-24 11:48:58 -03:00
karai17
3c3eebd66f Minor tweak 2016-07-24 11:39:36 -03:00
karai17
96a63ce581 Added a few more mat4 tests 2016-07-24 11:35:48 -03:00
karai17
c4fabe7f19 Made the tests less bad 2016-07-24 10:04:29 -03:00
karai17
2cb5d0970d Added to_frustum test 2016-07-24 04:43:06 -03:00
karai17
375f748c1f FFI'd color 2016-07-23 23:16:10 -03:00
karai17
864ac736de Reimplemented mat4 ffi (thanks @EntranceJew!)
Resolves issue #17
2016-07-23 22:46:09 -03:00
karai17
481825cba4 What ARE birds?
We just don't know.
2016-07-23 05:21:03 -03:00
karai17
fbf329264d Blood. Sweat. Tears. Mostly blood. And sweat. And tears. 2016-07-23 03:23:06 -03:00
karai17
d34cca315f Removed ffi from mat4, it caused a lot of problems and didn't work. 2016-07-22 17:13:11 -03:00
karai17
5f7a7f29fa Added quaternion tests
* Fixed an issue with is_quat, is_vec3, is_vec2, and is_mat4 methods
* Fixed a minor issue with local variables being declared too late
2016-07-21 20:04:32 -03:00
karai17
2950352ac8 Updated color module, etc. 2016-07-20 22:17:25 -03:00
karai17
a57673dcaf Added frustum and other intersect functions 2016-07-20 20:49:28 -03:00
karai17
f83b60e1e5 Fixed transforms multiplying in the wrong order 2016-07-20 18:36:04 -03:00
karai17
2aa0e7fcb6 Cleaned up internal code to be less verbose 2016-07-20 18:24:54 -03:00
karai17
d1a2c8c94b fixed mat4.__mul 2016-07-20 00:09:17 -03:00
karai17
bff981aa70 typo 2016-07-20 00:08:34 -03:00
karai17
5bee88b943 Fixed mat4.project and mat4.unproject 2016-07-20 00:07:49 -03:00
karai17
4f9bc17bf4 Refactored mat4
Did some tidying up on quat, vec2, vec3, and utils
2016-07-19 23:55:21 -03:00
karai17
f9d31b20fb Fixed a typo 2016-07-18 06:21:43 -03:00
karai17
46f8261ea0 Refactored mat4 (in progress)
Cleaned up vec2, vec3, quat
2016-07-18 06:17:42 -03:00
Colby Klein
7f7ff0077a Fix mat4 typos. 2016-04-13 21:57:39 -07:00
Landon Manning
5da09ddd8b removed ray_triangle2, it was too slow
also moved some vec3 definitions outside their respective function
bodies to speed thing sup and create less garbage
2015-12-29 04:58:53 -04:00
Matthew Blanchard
f4163b9893 Pruned mat4. Added quat.mul_vec3. 2015-12-28 11:11:45 -05:00
Landon Manning
c72efbad3c buncha goodies
* Changed add/sub in vec2/vec3 to allow for integer math
* Fixed a string display error in quat
* Other stuff that @shakesoda probably did
2015-12-13 06:16:57 -04:00
Colby Klein
78989682cf Add LDoc documentation. Utils done. 2015-09-11 07:59:05 -07:00
Colby Klein
d1dc50761f Fix mat4.look_at offset 2015-08-10 17:59:18 -07:00
Colby Klein
61e4c33852 Add mat4.hmd_perspective 2015-07-25 22:47:15 -07:00
Colby Klein
01f7aeeff9 Fix mat4.perspective 2015-07-25 19:27:07 -07:00
Colby Klein
f12e076782 Add conversions, fix unproject, perspective, m*v, look_at 2015-05-05 02:04:34 -07:00
Colby Klein
38dda4a265 Fix mat4.(un)project, rename persp to perspective.
Fixes #4
2014-10-30 13:45:16 -07:00