V - 3D vector library
mrsimb - Custom level - Jan 25, 2018 from WindowsUnfinished project - work in progress.
There is a minified version on the right one
-- Creating a vector:
v1 = V( 1, 2, 3 )
v2 = V( 10, 0 )
v3 = V( this:get_position() )
-- Accessing vector values:
x = v1.x
x, y, z = v1:values()
-- Adding:
v1 + v2
-- Substracting:
v1 - v2
-- Negating:
-v1
-- Distance:
V.dist(v1, v2)
v1:dist(v2)
-- Distance squared (faster, use for comparing distances):
V.distsq(v1, v2)
v1:distsq(v2)
-- Linear interpolation:
V.lerp(v1, v2, 0.5)
v1:lerp(v2, 0.5)
-- Converting to string:
tostring(v1)
CHANGELOG:
03.02.2018
- Removed unnecessary table creation
- Added dist, distsq, lerp
- Access through x, y, z fields instead of numeric indexes
- Code cleanup
TODO: pretty much all generic vector operations.
License: You can use it freely, just do not delete credits from the code (the first comment).
Downloads: 64 - Level ID: 27805