Commit Graph

398 Commits

Author SHA1 Message Date
Max Cahill
65d06d01f6 fixed pretty default config getting modified by parameters 2021-07-05 16:20:03 +10:00
Max Cahill
67019de5b5 made pretty module default config and doc comments consistent order 2021-07-05 16:18:03 +10:00
Max Cahill
3c5455d616 added pretty module to readme 2021-07-05 16:13:45 +10:00
Max Cahill
e726f19a5e added pretty module with pretty.print and pretty.string
breaking: string.pretty still exists but takes new config argument
2021-07-05 16:12:16 +10:00
Max Cahill
b44b92a32d refactored state machine to be clear about which variables and parameters are state tables, and which are name strings
breaking - changed some property and function names

fixes #16
2021-07-05 14:53:55 +10:00
Max Cahill
1de942daa8 Use luajit table.clear properly
Fixes #25
2021-06-29 14:46:40 +10:00
Max Cahill
a2c7800290 Note about branchless or abs-based mathx.sign 2021-06-29 14:44:09 +10:00
Max Cahill
fe135c533b More pooled storage for intersect.lua 2021-06-29 14:43:55 +10:00
Max Cahill
009beadc68 Updated performance note on functional.lua 2021-06-25 13:31:33 +10:00
Max Cahill
af919da379 Fixed intersect.lua line functions not all working properly with un-exported batteries 2021-06-17 11:29:14 +10:00
Max Cahill
9b95643e6e Added tablex.swap_and_pop 2021-06-09 19:49:04 +10:00
Max Cahill
0bc9ccb17b Merge branch 'feature/minmax-vector-ops-and-aabb-collisions' 2021-06-08 11:53:09 +10:00
Max Cahill
a92a0c0351 Reworked aabb vs point and circle methods 2021-06-08 11:51:18 +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
2128a38702
Merge pull request #24 from emdete/master
fix super_call to call in the next higher class
2021-06-08 09:56:35 +10:00
M. Dietrich
a4e677466a fix super_call to call in the next higher class 2021-06-07 16:44:39 +02:00
Max Cahill
b3bae9b0f2
Merge pull request #23 from monolifed/patch-1
rgb to hsl
2021-06-06 20:04:50 +10:00
monolifed
e9687d763f
rgb to hsl 2021-06-06 09:00:43 +03:00
Max Cahill
7e467b279f [added] more vec2 angle functions 2021-05-23 20:43:51 +10:00
Max Cahill
c1a4e6898a
Merge pull request #22 from DUznanski/shuffle-fix
Fix shuffle to avoid bias
2021-05-21 09:14:01 +10:00
DUznanski
2846de2ea3
Fix shuffle to avoid bias
There's a subtle trick in shuffling: you should draw only from the part of the deck you have not seen!  Otherwise, some permutations are more common than others.
2021-05-20 12:33:52 -07:00
Max Cahill
2d06ec7b9c [fixed] intersect.line_circle_overlap bug 2021-05-13 16:13:30 +10:00
Max Cahill
6fae516630 [added] :ipairs method for sequence, for convenient inline chaining - should consider making it the __call metamethod probably 2021-05-13 15:03:06 +10:00
Max Cahill
80c44f3436 [added] intersect.line_circle_overlap for checking boolean overlap circles vs lines 2021-05-13 12:24:45 +10:00
Max Cahill
af961ab2b8 [added] intersect.balance_from_mass which gets a normalised balance factor from two mass inputs, and treats <=0 or infinite or nil masses as static bodies 2021-05-11 15:47:48 +10:00
Max Cahill
a397d3d7f8 Merge remote-tracking branch 'origin/master' 2021-05-11 11:00:10 +10:00
Max Cahill
f343c1c0b7 [modified] optimised table.insert_sorted and made it _actually_ insert at the back of the range instead of at the first equal found position (not always the same) 2021-05-11 10:59:59 +10:00
Aweptimum
b5d3707939 Added aabb_circle_collide routine, modify aabb_point_collide
If circle center within aabb, calls aabb_point collide. Then, adds to the msv the difference between the closest point on the aabb to the circle and the closest point on circle to closest point on the aabb.

It failed when the circle center was exactly on the aabb edges, so COLLIDE_EPS was added to the apo_normal in aabb_point_collide to force the point off the edge. As such, the "nudge" section was removed. This should definitely be reviewed.
2021-05-10 12:29:37 -04:00
Aweptimum
06ca04bde7 Added aabb_circle_overlap
When the distance between the circle's center and the closest point on the aabb is less than the circle radius, returns true.
2021-05-10 11:55:51 -04:00
Aweptimum
bfee65762e Added helper function for aabb_circle routines
Clamps point coords to the dimensions of an aabb to get the nearest point on the aabb. Returns two integers to avoid garbage.
2021-05-10 11:55:00 -04:00
Aweptimum
9d1e563796 Added aabb_point_collide()
Pushes point out along minimum axis. Nudges it out with COLLIDE_EPS added to the msv.
2021-05-10 11:53:40 -04: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
89ecd4258e Merge remote-tracking branch 'origin/master'
# Conflicts:
#	tablex.lua
2021-05-04 21:07:35 +10:00
Max Cahill
5cd33398a5 [added] tablex.swap 2021-05-04 20:52:47 +10:00
Max Cahill
d9da4749e2 [added] some randomness helper functions to mathx 2021-05-04 11:41:22 +10:00
Max Cahill
7c975e8c4a [removed] prime stuff from mathx; hard to justify the filesize 2021-05-04 11:40:20 +10:00
Max Cahill
bc7754ae0b [modified] minor refactor of how tablex.clear is or isn't initialised as needed 2021-05-04 10:38:31 +10:00
Max Cahill
c2a9d39bcf [added] set.clear which does what you'd expect 2021-05-04 10:38:07 +10:00
Max Cahill
97eac9c51a Merge branch 'feature/insert-sorted-binary-search' 2021-04-30 11:47:03 +10:00
Max Cahill
826a2797c8 [modified] refactored insert_sorted to get PR #18 merged 2021-04-30 11:46:51 +10:00
Max Cahill
5601d9415b Merge remote-tracking branch 'origin/master' into feature/insert-sorted-binary-search 2021-04-30 11:22:11 +10:00
Alvaro Frias Garay
5ed6d68f6c added binary search to insert_sorted
Added method tablex.is_sorted
2021-04-15 21:09:04 -03:00
Max Cahill
87834e9267 [modified] sequence wrappers a bit more; exposed functional query interface 2021-04-15 10:31:06 +10:00
Max Cahill
39268148d8 Merge remote-tracking branch 'origin/master' 2021-04-15 10:22:37 +10: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
d476bc9c9c [modified] how sequence binds the functional interface to make binding new methods less error prone and shorter 2021-04-15 10:21:41 +10:00
Max Cahill
49505af37e Merge PR #17 2021-04-14 17:07:14 +10:00
Max Cahill
62957a9270 [modified] PR #17 a little; simplified various unneeded sections and added comments 2021-04-14 17:06:31 +10:00