An abstract 3D Vector type that maps to native fixed-length array in target language, with all methods inlined
Static methods
staticinlinecross(v1:Vec3, v2:Vec3):Vec3
Compute the cross product of two vectors
Parameters:
v1 | the first vector |
|---|---|
v2 | the second vector |
Returns:
the cross product
staticinlinedist(v1:Vec3, v2:Vec3):Float
Compute the (Euclidean) distance between two vectors
Parameters:
v1 | the first vector |
|---|---|
v2 | the second vector |
Returns:
the distance
Variables
Methods
inlineadd(rhs:Vec3):Vec3
Overload + operator to add vectors
Parameters:
rhs | the other vector |
|---|
Returns:
elementwise sum
inlineassign(v:Vec3):Void
Set x y z components of this vector from another vector
Parameters:
v | the vector to copy from |
|---|
inlineget(i:Int):Float
Get vector x/y/z component via subscript operator [0] [1] [2]
Parameters:
i | the index |
|---|
inlinemul(rhs:Vec3):Vec3
Overload * operator to multiply vectors elementwise
Parameters:
rhs | the other vector |
|---|
Returns:
hadamard product
inlinemulf(rhs:Float):Vec3
Overload * operator to multiply vector by a scalar
Parameters:
rhs | the scalar |
|---|
Returns:
scaled vector
inlineset(i:Int, v:Float):Float
Set vector x/y/z component via subscript operator [0] [1] [2]
Parameters:
i | the index |
|---|---|
v | the value to write |