- basic arithmetic operators (
+-*/
) overloaded for other Vec objects or floats - other helper methods
func. name | function |
---|---|
toString() /toString(int) |
output vector as "(x, y, [z])" , can specify number of decimals |
length() /lengthSquared() |
length/dot product with self |
func. name | function | note |
---|---|---|
dot() |
dot product between two vectors | |
distance() /distanceSquared() |
length/length squared of (b-a) |
|
reflect() |
reflect off surface with given normal | implementation here |
refract() |
refract through surface with given normal, ratio of IoR's | implementation ^ |
abs() |
all components thru abs() |
|
step() |
all components thru step() |
identical behavior to here |
sign() |
all components thru sign() |
identical behavior to ^ |
func. name | function | note |
---|---|---|
normalize() |
normalize given vector | TODO: for Vec2 , too |
cross() |
cross product of two vectors | implementation here, TODO: handedness specification |
min() /max() |
all components thru min() /max() |
TODO: for Vec2 , too |
lerp() |
all components thru lerp() |
TODO: overload for float index, for Vec2 , too |
pow() |
all components thru pow() |
TODO: overload for float base/power, for Vec2 , too |
- testing for
Vec3
helper methods