249 Commits

Author SHA1 Message Date
mcc
f7497b9bf7 Manual merge PR#52 2020-05-03 12:50:42 -04:00
mcc
6e1cf4be56 Manual merge PR#51 2020-05-03 12:46:30 -04:00
mcclure
d4f7cd1280
Merge pull request #50 from mcclure/master
:round(precision) methods for vec2, vec3, bound2, bound3
2020-05-03 12:37:58 -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
9cd858a0ef Add tests to identity-quat patch and also take an axis not a full value for the identity fallback 2020-04-25 18:32:48 -04:00
mcc
f27f5520b1 Fix for issue #55 (quat():to_angle_axis() returns gibberish) 2020-04-25 18:06:09 -04:00
mcclure
86f0056397
Merge pull request #47 from mcclure/master-test-failures
Fix failing tests
2019-11-30 17:37:03 -05:00
mcc
185b19d766 vec2.to_vec3(z) creates a vec3 with the given z (or 0) 2019-11-30 11:31:22 -05:00
mcc
7452cc0c6c Simple methods for flipping a vector on exactly 1 axis 2019-11-30 11:25:00 -05:00
mcc
e3f817bf7e extend(vec) and extend_bound(bound) for bounds
expands bounds to cover new points
2019-11-30 01:24:48 -05:00
mcc
8e65db07ce :round(precision) methods for vec2, vec3, bound2, bound3
Uses utils.lua, which requires moving utils.round to a new _private_utils.lua
2019-11-30 00:03:55 -05: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
mcclure
00126f19c9
Merge pull request #46 from mcclure/vec-constructor-clone
Make vec2(vec2(1,2)) and vec3(vec3(1,2,3)) consistent between lua/luajit
2019-11-29 21:21:12 -05:00
mcclure
3e94b3abd8
Merge pull request #45 from mcclure/bound-to-string
to_string methods for bound2 and bound3
2019-11-29 21:20:48 -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
mcc
b80543c242 Make vec2(vec2(1,2)) and vec3(vec3(1,2,3)) consistent between lua and luajit 2019-11-29 14:44:34 -05:00
mcc
76cdaa8c6b to_string methods for bound2 and bound3 2019-11-29 11:33:21 -05:00
mcc
7ac8b80f3f Remove DO_THRESHOLD check from quat.pow; this was an accidental, inappropriate copypaste from lerp(). 2019-11-29 11:23:27 -05:00
s-ol
781424c8cb fix bound2 contains 2019-11-01 01:00:58 +01:00
Colby Klein
a1f7f7d3fc
Fix BVH
ray intersections with it seem to be working now in testing
2019-04-23 09:30:44 -07:00
Landon Manning
654089031d Added expiramental BVH implementation
* Added: BVH.lua
* Changed: ray_triangle intersect can now optionall check for backface intersections
2019-04-22 22:21:48 -03:00
Colby Klein
e8f32d68cf fix issue #26 2018-12-26 01:55:17 -08:00
howmanysmall
677cb31de7
Update utils.lua
removed `math.sqrt` in favor of `^ 0.5`
2018-12-25 12:36:50 -07:00
Colby Klein
130fe2aca0
Merge pull request #30 from mcclure/aabb
Axis-aligned bounding box classes for 2 and 3 dimensions
2018-02-22 04:09:36 -08:00
Colby Klein
ef46425cfe
Merge pull request #29 from mcclure/quat-component
Quaternions: Add "unpacked" versions of to_angle_axis and from_angle
2018-02-22 04:07:06 -08:00
Colby Klein
cf704d760e
Merge pull request #31 from mcclure/quat-mult
Clarify handedness of quaternion multiplication in documentation
2018-01-30 11:50:57 -08:00
mcc
7c18a65695 Bound2, bound3: Add tests and fix several major bugs so that those tests pass. 2018-01-27 00:46:56 -05:00
mcc
5637034445 Clarify handedness of quaternion multiplication 2018-01-26 10:47:22 -05:00
mcc
c9cacf5d58 Axis-aligned bounding box classes for 2 and 3 dimensions 2018-01-26 10:30:03 -05:00
mcc
b5beacffc7 component_min(a,b) and component_max(a,b) functions for vector classes 2018-01-26 10:06:01 -05:00
mcc
bb4d945c94 Various cleanup on color class
- Expose table versions of color-to-hsv and hsv-to-color
- Proper behavior on color.new(nil)
- Documentation
2018-01-26 10:00:38 -05:00
mcc
d4fb346f0c Quaternions: Add "unpacked" versions of to_angle_axis and from_angle_axis (passing x, y and z in and out instead of using a vec3) 2018-01-26 09:33:25 -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
0ff68c69fd fix lerp for vec3, update tests for broken lerp case 2017-05-19 09:49:07 -07:00
YellowTide
fbf017786e fixed functionality of utils.lerp()
((a - b) + b)*t = a*t
switched to
(1-t)*b + a*t

visualization of change:
https://www.desmos.com/calculator/91ge9obdoi
2017-05-19 07:01:07 -05:00
Colby Klein
b53cebb8ca fix comment 2017-03-29 07:46:55 -07:00
Colby Klein
65e3676af5 swap lerp arg order, fix tests 2017-03-29 07:42:40 -07:00
Colby Klein
c7622dd91b add intersect.ray_capsule 2017-03-29 07:24:38 -07:00
Colby Klein
b122e4d726 fix typo 2017-03-29 05:32:16 -07:00
Colby Klein
e8228f8c8a fix lerp for types like vec3 by changing order, add decay 2017-03-29 05:32:04 -07:00
Colby Klein
3a18ed0f8c temporarily revert mat4.lua due to bugs 2016-12-22 11:17:58 -08:00
Pedro Gimeno Fortea
d9108a198a Make pow work with non-integer exponents.
As a side effect, it no longer works with non-normalized quaternions.
2016-12-16 00:32:52 -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
karai17
e3cafd6c2f tidied up color 2016-12-14 20:45:11 -04:00