Class b2Vec3

A 2D column vector with 3 elements.

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(x?: number, y?: number, z?: number): b2Vec3

Construct using coordinates x,y,z.

Parameters

  • x?: number optional

    x value, default = 0.

  • y?: number optional

    y value, default = 0.

  • z?: number optional

    z value, default = 0.

Returns

b2Vec3

Properties

public x: number

x value.

public y: number

y value.

public z: number

z value.

Methods

public Add(v: b2Vec3)

Adds the vector 3 to this vector 3. The result is stored in this vector 3.

Parameters

public Copy(): b2Vec3

Creates a copy of the vector 3.

Returns

b2Vec3

Copy of this vector 3.

public GetNegative(): b2Vec3

Gets the negative of this vector 3.

Returns

b2Vec3

Negative copy of this vector 3.

public Multiply(a: number)

Vector multiplication. Stores the result in this vector 3.

Parameters

  • a: number

    Value to multiple the vector's values by.

public NegativeSelf()

Sets this vector 3 to its negative.

public Set(x?: number, y?: number, z?: number)

Sets the vector 3.

Parameters

  • x?: number optional

    x value, default is 0.

  • y?: number optional

    y value, default is 0.

  • z?: number optional

    z value, default is 0.

public SetV(v: b2Vec3)

Sets the vector 3 from a vector 3.

Parameters

  • v: b2Vec3

    Vector 3 to copy values from.

public SetZero()

Sets the vector 3 to zero values.

public Subtract(v: b2Vec3)

Subtracts the vector 3 from this vector 3. The result is stored in this vector 3.

Parameters

  • v: b2Vec3

    Vector 3 to subtract.