abstract hxmath.math.Vector4(Vector4Shape) from Vector4Shape to Vector4Shape
Available on all platforms
A 4D vector (used with homogenous/projection matrices in 3D).
Class Fields
function equals(a:Vector4, b:Vector4):Bool
Test element-wise equality between two vectors. False if one of the inputs is null and the other is not.
a | |
b | |
returns | ai == bi |
function fromArray(rawData:Array<Float>):Vector4
Construct a Vector4 from an array.
rawData | The input array. |
returns | The constructed structure. |
function lerp(a:Vector4, b:Vector4, t:Float):Vector4
Linear interpolation between two vectors.
a | The value at t = 0 |
b | The value at t = 1 |
t | A number in the range [0, 1] |
returns | The interpolated value |
function notEquals(a:Vector4, b:Vector4):Bool
Test inequality between two vectors.
a | |
b | |
returns | !(ai == bi) |
Instance Fields
function new(?x:Float = 0.0f, ?y:Float = 0.0f, ?z:Float = 0.0f, ?w:Float = 0.0f):Vector4Shape
Constructor.
x | |
y | |
z | |
null | w |
function addWith(a:Vector4):Vector4
Add a vector in place. Note: += operator on Haxe abstracts does not behave this way (a new object is returned).
a | |
returns | selfi += ai |
function applyScalarFunc(func:Float ->Float):Vector4
Apply a scalar function to each element.
func | The function to apply. |
returns | The modified object. |
function copyTo(other:Vector4):Void
Copy the contents of this structure to another.
other | The target structure. |
function getArrayElement(i:Int):Float
Get an element by position.
i | The element index. |
returns | The element. |
function setArrayElement(i:Int, value:Float):Float
Set an element by position.
i | The element index. |
value | The new value. |
returns | The updated element. |
function subtractWith(a:Vector4):Vector4
Subtract a vector in place. Note: -= operator on Haxe abstracts does not behave this way (a new object is returned).
a | |
returns | selfi -= ai |