4D vector.
Methods
Adds v to this vector.
Parameters
Returns
Vector4
public addScalar(s: number): Vector4
Parameters
Returns
Vector4
Sets this vector to a + b.
Parameters
Returns
Vector4
Parameters
Returns
Vector4
Parameters
Returns
Vector4
public clampScalar(min: number, max: number): Vector4
Parameters
Returns
Vector4
public clone(): Vector4
Clones this vector.
Returns
Vector4
Copies value of v to this vector.
Parameters
Returns
Vector4
public distanceTo(v: Vector): number
NOTE: Vector4 doesn't have the property.
distanceToSquared(v:T):number;
Parameters
Returns
number
public distanceToSquared(v: Vector): number
NOTE: Vector4 doesn't have the property.
distanceToSquared(v:T):number;
Parameters
Returns
number
public divideScalar(s: number): Vector4
Divides this vector by scalar s.
Set vector to ( 0, 0, 0 ) if s == 0.
Parameters
Returns
Vector4
public dot(v: Vector4): number
Computes dot product of this vector and v.
Parameters
Returns
number
public equals(v: Vector4): boolean
Checks for strict equality of this vector and v.
Parameters
Returns
boolean
public fromArray(xyzw: Array<number>): Array<number>
Parameters
Returns
Array<number>
public getComponent(index: number): number
Parameters
Returns
number
public length(): number
Computes length of this vector.
Returns
number
public lengthManhattan(): number
Returns
number
public lengthSq(): number
Computes squared length of this vector.
Returns
number
public lerp(v: Vector4, alpha: number): Vector4
Linearly interpolate between this vector and v with alpha factor.
Parameters
Returns
Vector4
Parameters
Returns
Vector4
Parameters
Returns
Vector4
public multiplyScalar(s: number): Vector4
Multiplies this vector by scalar s.
Parameters
Returns
Vector4
public negate(): Vector4
Inverts this vector.
Returns
Vector4
public normalize(): Vector4
Normalizes this vector.
Returns
Vector4
public roundToZero(): Vector4
Returns
Vector4
public set(x: number, y: number, z: number, w: number): Vector4
Sets value of this vector.
Parameters
-
x: number
-
y: number
-
z: number
-
w: number
Returns
Vector4
public setComponent(index: number, value: number)
Parameters
-
index: number
-
value: number
public setLength(l: number): Vector4
Normalizes this vector and multiplies it by l.
Parameters
Returns
Vector4
public setW(w: number): Vector2
Sets w component of this vector.
Parameters
Returns
Vector2
public setX(x: number): Vector2
Sets X component of this vector.
Parameters
Returns
Vector2
public setY(y: number): Vector2
Sets Y component of this vector.
Parameters
Returns
Vector2
public setZ(z: number): Vector2
Sets Z component of this vector.
Parameters
Returns
Vector2
Subtracts v from this vector.
Parameters
Returns
Vector4
Sets this vector to a - b.
Parameters
Returns
Vector4
public toArray(): Array<number>
Returns
Array<number>