290 Commits

Author SHA1 Message Date
David Briscoe
1b2aeffe00 Allow coveralls failure
Fails like this even though we explicitly pass the token:
```
Upload error: Couldn't find a repository matching this job.
Upload error: Couldn't find a repository matching this job.
Upload error: Couldn't find a repository matching this job.
Error: Process completed with exit code 255.
```
2021-06-23 16:28:47 -07:00
David Briscoe
dbc8d7cf85 Add coveralls repo token to gh action 2021-06-23 16:25:21 -07:00
David Briscoe
6bc8193a5a Run tests on gh actions
Related #60.

Can't figure out what's wrong with travis, but gh actions seem to work.
Migrated travis.yml to runtest.yml.

coveralls fails for me because I don't have the account there, but it's
reporting coverage amounts before it fails to upload.

Tests against multiple versions of lua using leafo's matrix.luaversion
with roughly the same versions as travis.yml.

What's missing
==============

Notification setup from travis is missing. Github sends email
notifications. You can choose:
 * Email
 * Web
 * Send notifications for failed workflows only
There are third-party irc gh actions, but I don't see how you'd do
`on_success: change` in an action.

luacheck was disabled in travis.yml, so it's disabled here too.
2021-06-23 16:21:21 -07:00
Colby Klein
7a7e748430
Merge pull request #61 from idbrii/automate-docs
Automate ldoc generation
2021-06-23 15:49:44 -07:00
David Briscoe
5d303a22e2 Automate ldoc generation
Related #11.

Builds docs to the gh-pages branch on every push to master. Also updates
all dead links to point to live ones (or ones that will be live after
this is merged).

Uses three third-party gh actions:

* leafo/gh-actions-lua@v8
* leafo/gh-actions-luarocks@v4
* peaceiris/actions-gh-pages@v3
 * This receives secrets.GITHUB_TOKEN

Also switches to the new ldoc css and moves doc output folder to
./doc/out which is less confusing when configuring than ./doc/doc.

Once merged, docs will be available on https://excessive.github.io/cpml/

Currently, you can see the built docs on https://idbrii.github.io/love-cpml/
2021-06-23 14:33:46 -07:00
Colby Klein
ff8ba77b7a
Update README.md
arbitrary change to kick travis separate from the build trigger
2021-06-17 11:44:37 -07:00
Colby Klein
43f100a12d
Update README.md 2021-06-17 11:26:25 -07:00
mcclure
85988fc7c6
Merge pull request #59 from idbrii/fix-angleto
Fix angle_to to produce signed angle instead of incorrect results
2021-06-17 11:25:16 -04:00
David Briscoe
39aee9a421 Fix angle_to to produce signed angle
angle_to was producing the angle from +x to the difference between a,b
which is unexpected. Instead, it should produce the smallest absolute
angle between the two vectors and be signed to indicate the direction of
rotation.

By using the old angle_to implementation and modifying equal() to print
out the failures, you can see the numbers that it was producing before
didn't make much sense:

    right:angle_to(down) = 45.0
    right:angle_to(left) = 0.0
    right:angle_to(up)   = -45.0
    down:angle_to(right) = -135.0
    down:angle_to(left)  = -45.0
    down:angle_to(up)    = -90.0
    left:angle_to(down)  = 135.0
    left:angle_to(up)    = -135.0
    up:angle_to(right)   = 135.0
    up:angle_to(down)    = 90.0
    up:angle_to(left)    = 45.0

Now it produces numbers you'd expect:

    right:angle_to(down) = -90.0
    right:angle_to(left) = 180.0
    right:angle_to(up)   = 90.0
    down:angle_to(right) = 90.0
    down:angle_to(left)  = -90.0
    down:angle_to(up)    = 180.0
    left:angle_to(down)  = 90.0
    left:angle_to(up)    = -90.0
    up:angle_to(right)   = -90.0
    up:angle_to(down)    = 180.0
    up:angle_to(left)    = 90.0

See also https://stackoverflow.com/questions/21483999/using-atan2-to-find-angle-between-two-vectors

Also added tests for angle_between.
2021-06-15 11:56:04 -07:00
mcc
0d8daf0536 Fix typo breaking round() calls 2020-05-21 23:39:14 -04:00
mcc
ddb80f48e6 Compatibility note for 1.0 release and PR#48 test 2020-05-03 13:36:26 -04: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
mcc
4319828b4c Compatibility note for 0.10 release 2020-05-03 13:08:24 -04:00
mcc
3490d04ac1 Fix breaking test 2020-05-03 13:00:22 -04:00
mcclure
61affeb669
Merge pull request #56 from mcclure/identity-quat
Fix for issue #55 (quat():to_angle_axis() returns gibberish)
2020-05-03 12:54:47 -04:00
mcc
336f416f29 Manual merge PR#53 2020-05-03 12:52:17 -04:00
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
9155efb4b9
Merge pull request #54 from mcclure/bsd-2
Include BSD-2-clause text in LICENSE.md
2020-05-03 12:39:22 -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
4cb051614d Include BSD-2-clause text in LICENSE.md 2019-11-30 11:41:48 -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
d845a479ac Fix typo in bound3 test which was breaking under LuaJIT 2019-11-29 21:08:04 -05:00
mcc
7667ea9a3d Fix typo in bound2 test which was breaking under LuaJIT 2019-11-29 17:55:03 -05:00
mcclure
127935e0d8
Merge pull request #44 from mcclure/no-dot-threshold
Remove DO_THRESHOLD check from quat.pow
2019-11-29 17:18:47 -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
mcclure
6c49915112
Merge pull request #42 from s-ol/bound2-fix
fix bound2:contains()
2019-11-01 10:43:07 -04:00
s-ol
74de1154aa include bound2 and bound3 in init.lua 2019-11-01 01:02:03 +01: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
Colby Klein
20a072c14c
Merge pull request #36 from howmanysmall/patch-1
Update utils.lua
2018-12-26 01:45:16 -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