Commit Graph

29 Commits

Author SHA1 Message Date
Max Cahill
d31d7425aa added vec2.nearer (note: can be called as v:nearer(a, b)) 2024-05-08 15:09:59 +10:00
Max Cahill
aee733833e added alias for nequals for vec2 2024-03-27 12:32:57 +11:00
Max Cahill
ef4ef69b0f made vector metamethods not do inplace modifications (was completely unsafe and i can't believe i missed it on review :D sorry folks) 2024-01-19 10:25:04 +11:00
Bill Hilbert
2d0abbd021 use existing methods 2023-12-13 11:10:20 -05:00
Bill Hilbert
f29882c2ee add meta functions for mathmatical operators 2023-12-12 21:53:36 -05:00
David Briscoe
8d41c6d3d1 lint: Fix whitespace issues
Remove excess whitespace and remove related ignores.
2022-03-03 10:17:34 -08:00
Max Cahill
ad8012c89b added normalize alias for americans to vec2 2021-08-09 19:27:29 +10:00
Max Cahill
fa742beb50 reorganised some of vec2, added some missing copying methods 2021-08-09 19:07:03 +10:00
Max Cahill
4bb3da7603 slightly tweaked vec2 new 2021-07-23 14:38:14 +10:00
Max Cahill
f835dd6e66 vec2 api finalisation and testing, updating intersect to new api 2021-07-23 14:15:30 +10:00
Max Cahill
cb35811b8c start of vec2 friendly api - will settle on something here before touching vec3 2021-07-23 10:58:21 +10:00
Max Cahill
a339854651 fixed vec2/vec3 crashing on attempted copy construction from something that had a type field which wasn't a callable type() method (eg objects from tiled) 2021-07-16 19:23:59 +10:00
Max Cahill
3cc177a0c0 BREAKING class interface refactor - all classes will need a minor update, see class.lua
tl;dr is that new no longer needs to call init, calling :new() directly in user code is not allowed, properties are copied, metamethods work, and a config table is needed rather than a class to extend from, so use {extends = superclass} if you want a minimal fix
2021-07-15 16:15:27 +10:00
Max Cahill
0bc9ccb17b Merge branch 'feature/minmax-vector-ops-and-aabb-collisions' 2021-06-08 11:53:09 +10:00
Max Cahill
99c496df24 Added maxcomp and mincomp and specified major/minor to always mask an axis - removed farthest and closest because they were under-specified as a result (and questionable utility) 2021-06-08 11:50:54 +10:00
Max Cahill
a73a44f424 Added vec2:signi and vec2:sign to get the sign of each component 2021-06-08 11:49:29 +10:00
Max Cahill
bcd94c134e Added vec2 support for multiple concurrent release to pool 2021-06-08 11:48:58 +10:00
Max Cahill
7e467b279f [added] more vec2 angle functions 2021-05-23 20:43:51 +10:00
Aweptimum
bc014db183 Added min/max ops to vec2
major/minor return the component with the max/min value.

farthest/closest return the component with the max/min magnitude
2021-05-10 11:52:08 -04:00
Max Cahill
d1b7e77b8a [modified] vec2 to support direct use for conversion in functional.map 2021-04-15 10:22:26 +10:00
Max Cahill
afd279f1db [added] tostring for vec2 and vec3 - not sure how to handle wanting more/less precision for these currently. 2020-04-08 21:10:03 +10:00
Max Cahill
6386aaf298 [modified] big refactor to localised modules and require("batteries"):export() for global usage; renamed files table to tablex and math to mathx to allow using the library in your module root if you really want to. 2020-04-07 13:49:10 +10:00
Max Cahill
9422152181 [added] math.lerp_eps and matching vec2/vec3 methods; for ensuring a lerp actually reaches its destination once the delta doesn't matter 2020-04-01 20:58:18 +11:00
Max Cahill
c7d96461cf [added] intersect.point_in_poly and required plumbing 2020-04-01 19:28:22 +11:00
Max Cahill
370aee6cbc [added] vec2:new supports .x .y table argument 2020-03-18 21:22:11 +11:00
Max Cahill
ad2fc71e7a [fixed] non-global compatible 2020-03-15 21:22:22 +11:00
Max Cahill
66a9f41474 [modified] renamed to batteries, added global export suppression and more documentation 2020-03-15 20:28:50 +11:00
Max Cahill
63448b5d5e [added] vec3.lua (very quick work, probably would benefit from tests) 2020-01-29 21:12:14 +11:00
Max Cahill
2f470cf7c7 initial commit 2020-01-29 14:26:28 +11:00