143 Commits

Author SHA1 Message Date
Landon Manning
55685bedcc Added second ray_triangle function for performance testing
We should exercise both to see which performs better.
2015-12-28 12:02:22 -04:00
Landon Manning
437ac9135e Reimplemented quat*vec3, quat/quat, and quat/number
Fixed a few minor things in vec2 and vec3
2015-12-28 10:15:05 -04:00
Matthew Blanchard
8c9214764e Fixed a small bug in vec2. 2015-12-25 22:19:53 -05:00
Matthew Blanchard
85655e65af Refactored quat and added doc comments. Fixed some small typos and doc comments in vec2. 2015-12-25 20:06:31 -05:00
Matthew Blanchard
c60a324010 Fixed some small holdovers from vec3 remaining in vec2. 2015-12-25 18:44:03 -05:00
Matthew Blanchard
c5d02e0683 Updated vec3 doc comments. Brought vec2 in line with vec3. Doc commented vec2. 2015-12-25 18:35:03 -05:00
Matthew Blanchard
4302b2b5dc Added unit vectors. 2015-12-24 16:49:21 -05:00
Matthew Blanchard
2b35d4ae57 Removed defaults. Added trim. Reworked __call so it works correctly. Made all functions return out. 2015-12-24 16:46:58 -05:00
Matthew Blanchard
6116576ad0 Fixed a small typo in vec3 2015-12-23 04:50:53 -05:00
Matthew Blanchard
94ef22b643 Fixed issues with ffi and cloning.
Fixed the ffi check to now work correctly and moved the ffi local up a
scope so that it could be used later in the file. Made clone simply call
new().
2015-12-23 03:19:09 -05:00
Matthew Blanchard
bb78a486b0 Fixed merge conflicts. Refactored reflect and refract. 2015-12-22 18:05:39 -05:00
Matthew Blanchard
57704e9dba Added standard Lua fallback and documentation. 2015-12-22 17:55:59 -05:00
Landon Manning
71af8f5498 Rewrote quaternion module
Untested, but I hope it works!
2015-12-22 05:27:22 -04:00
Colby Klein
b9e004dc1a Add vec3.reflect and vec3.refract 2015-12-20 22:55:38 -08:00
Colby Klein
82f336a7f4 Fix broken vec2/vec3 clone. 2015-12-20 22:38:36 -08:00
Matthew Blanchard
5a9aabadb5 Revert "Added simple object and shape constructors"
This reverts commit 10f472771b00b79a479ab54c879f10d234197166.
2015-12-20 22:40:33 -05:00
Landon Manning
10f472771b Added simple object and shape constructors
ray, aabb, obb, plane, sphere, line, triangle
2015-12-20 22:35:06 -04:00
Landon Manning
7143dcadae Wrote cpml instead of vec3 in some places 2015-12-20 20:54:57 -04:00
Landon Manning
870a3c5129 Updated vec2 to match new vec3
Fixed code consistency in vec3 as well.
2015-12-20 06:09:09 -04:00
Landon Manning
8b136798d2 Updated intersect to use new vec3
Improved code consistency as well.
2015-12-20 05:24:28 -04:00
Matthew Blanchard
aba6b9b1c1 Corrected an issue with vec3 2015-12-19 23:56:56 -05:00
Matthew Blanchard
2ce72e3d0c Removed redundant vec3-turbo. 2015-12-19 23:49:51 -05:00
Matthew Blanchard
1531bf4abb Refactored the vec3 class. 2015-12-19 23:49:03 -05:00
Matthew Blanchard
3893afcd84 Removed redundant point.lua 2015-12-19 23:44:21 -05:00
Davis
8a3ee6a4fb Merge pull request #10 from davisdude/master
Added point.lua
2015-12-14 14:56:21 -05:00
Davis
2d075e32ff Fixed metamethods 2015-12-13 14:01:53 -05:00
Landon Manning
cda145629d I'm an idiot
the order in which a and b appear actually matters in add/sub.
2015-12-13 06:44:02 -04:00
Landon Manning
84999568e8 Merge branch 'master' of https://github.com/excessive/cpml
Conflicts:
	modules/octree.lua
2015-12-13 06:21:41 -04:00
Landon Manning
c72efbad3c buncha goodies
* Changed add/sub in vec2/vec3 to allow for integer math
* Fixed a string display error in quat
* Other stuff that @shakesoda probably did
2015-12-13 06:16:57 -04:00
Davis
8df04c0d73 Fixed string.format error 2015-12-11 23:44:26 -05:00
Davis
6b0be055b7 Added point.lua 2015-12-11 22:08:53 -05:00
Kyle McLamb
2cfea03fcc Remove dependency on lume
Since it was only used once it makes more sense just to inline that particular call
2015-12-08 13:16:42 -05:00
Colby Klein
c4a33434b2 Add cpml.quat.from_direction 2015-11-20 17:03:23 -08:00
Colby Klein
e5d0dc799c Add filter function to octree.draw_objects for debugging. 2015-11-20 01:50:48 -08:00
Landon Manning
0481a97195 Added ray casting to octree
* fixed octree API to match the rest of CPML
* standardized intersect inputs a bit more
2015-11-19 14:14:55 -04:00
Landon Manning
b51c6fc1be Added license info 2015-09-25 03:08:15 -03:00
Landon Manning
ab1d551b25 Added new octree implementation
reverted encapsulate_aabb intersect to be non-explicit
2015-09-25 02:54:38 -03:00
Landon Manning
2370daf5f3 Encapsulate should be explicit
inner needs to actually be inside outer, they cannot be the same size or
on the same plane(s).
2015-09-24 01:30:32 -03:00
Landon Manning
50edbb1b82 Added some intersects
* Added aabb_aabb
* Added encapsulate_aabb
* Changed point_aabb to take a min and max instead of position and
volume
* Removed boolean returns from line_line and segment_segment
2015-09-24 01:05:20 -03:00
Colby Klein
4a4ad08a35 Add vec2.lerp, tests, and fix some minor bugs.
- Added missing vec2 lerp (same as vec3's)
- Added lerp to vec2 and vec3 metatable
- Added tests for vec2 (incomplete)
- Fixed vec2/number being the same as number/vec2
- Fixed vec2 constructor to match vec3's
2015-09-15 07:05:22 -07:00
Colby Klein
951aea865f Proper fix for the quat.to_axis_angle bug.
Apparently, I was getting a number so close to -1 (but just under) that
it just printed as -1. Fuck off.
2015-09-14 13:35:01 -07:00
Colby Klein
18dd29d1b5 Work around math.acos(-1) returning NaN on LuaJIT... sometimes. 2015-09-14 13:26:05 -07:00
Colby Klein
6a5771348c Minor doc/test updates for vec3 2015-09-13 05:51:13 -07:00
Colby Klein
fb1778e45c Update vec3 docs 2015-09-11 13:39:19 -07:00
Colby Klein
78989682cf Add LDoc documentation. Utils done. 2015-09-11 07:59:05 -07:00
Landon Manning
449bf861d4 Added ability to divide a number over a vector.
Example: `local s = 1/scale`
2015-09-09 23:14:33 -03:00
airstruck
a4d611c227 fix tabs 2015-09-08 05:05:39 -04:00
airstruck
b50194bebc support negative values passed to frexp 2015-09-08 05:01:11 -04:00
Colby Klein
5081314be6 Missed a line. 2015-09-08 01:35:38 -07:00
Colby Klein
7257d1b343 Use our own frexp if it's not available (Lua 5.3+) 2015-09-08 01:33:19 -07:00