abstract hxmath.math.Vector3(Vector3Type) from Vector3Type to Vector3Type

Available on all platforms

A 3D vector.

Class Fields

function add(a:Vector3, b:Vector3):Vector3

Add two vectors.

a
b
returns

a + b

function cross(a:Vector3, b:Vector3):Vector3

Cross product. The resulting vector is orthogonal to the plane defined by the input vectors.

a
b
returns

a X b

function dot(a:Vector3, b:Vector3):Float

Dot product.

a
b
returns

sumi (ai * b_i)

function equals(a:Vector3, b:Vector3):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>):Vector3

Construct a Vector3 from an array.

rawData

The input array.

returns

The constructed structure.

function lerp(a:Vector3, b:Vector3, t:Float):Vector3

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 negate(a:Vector3):Vector3

Create a negated copy of a vector.

a
returns

-a

function notEquals(a:Vector3, b:Vector3):Bool

Test inequality between two vectors.

a
b
returns

!(ai == bi)

function scalarMultiply(s:Float, a:Vector3):Vector3

Multiply a scalar with a vector.

s
a
returns

s * a

function subtract(a:Vector3, b:Vector3):Vector3

Subtract one vector from another.

a
b
returns

a - b

Instance Fields

function new(?x:Float = 0.0f, ?y:Float = 0.0f, ?z:Float = 0.0f):Vector3Type

Constructor.

x
y
null

z

function addWith(a:Vector3):Vector3

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):Vector3

Apply a scalar function to each element.

func

The function to apply.

returns

The modified object.

function clone():Vector3

Clone.

returns

The cloned object.

function copyTo(other:Vector3):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:Vector3):Vector3

Subtract a vector in place. Note: -= operator on Haxe abstracts does not behave this way (a new object is returned).

a
returns

selfi -= ai