forward, side, new_up are unused but are shadowed in many functions.
Doesn't seem like they're intended to be used.
No reason for variables in CreateNDCScaleAndOffsetFromFov to be global.
Don't try running this change, but I'm just making them local.
Fix "Error: src/lib/cpml/modules/_private_utils.lua:8: attempt to index
global 'utils' (a nil value)"
Looks like when round was moved to _private_utils, this didn't get
replaced. There is no utils defined and utils.round just points to
private.round.
Add a test. This never triggered test failures because test don't pass
precision.
Test
A love2d program with main.lua:
local Vec2 = require "cpml.modules.vec2"
local v = Vec2(1.234, 3.5326)
print(v:round(0.1))
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.
```
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.
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/
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.
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.