V8 Javascript API

RS.Math.Vector3 Class Reference

[Math]

Description

A 3 Component vector.

Constructor

 Vector3( Object vector)
More...

Functions

Vector3 add( Vector3 rhs)
Adds rhs to this vector and stores the result in this vector. More...
 clone()
returns a copy of this vector.
Vector3 cross( Vector3 rhs)
Returns the cross product between this vector and rhs. More...
Number distance( Vector3 rhs)
Returns the distance between the point specified by this vector and rhs. More...
Vector3 divide( Vector3 rhs)
Divide rhs into this vector and stores the result in this vector. More...
Number dot( Vector3 rhs)
Returns the dot product between this vector and rhs. More...
Boolean equal( Vector3 rhs, Boolean use_tolerance)
Returns true if this vector equals rhs. More...
Boolean equal_with_tolerance( Vector3 rhs, Number tolerance)
Returns true if this vector equals rhs using tolerance. More...
Boolean is_colinear( Vector3 rhs)
Returns true if this vector and rhs are colinear. More...
Boolean is_null_vector( Number tolerance)
Checks if the vector is the null vector. More...
Number length()
Returns the length of this vector. More...
Vector3 multiply( Vector3 rhs)
Multiplies rhs with this vector and stores the result in this vector. More...
Vector3 normalize()
Normalizes this vector. More...
Vector3 rotate( Matrix4x4 matrix)
Rotates this vector by applying the provided matrix. More...
Vector3 rotate_to( Matrix4x4 matrix, Vector3 out)
Rotates this vector by applying the provided matrix. More...
Vector3 rotate_transpose( Matrix4x4 matrix)
Rotates this vector by the transpose of the provided matrix. More...
Vector3 rotate_transpose_to( Matrix4x4 matrix, Vector3 out)
Rotates this vector by the transpose of the provided matrix. More...
Vector3 scale( Number scale)
Scales this vector. More...
 set( Object rhs)
Sets this vector from an object. More...
Vector3 subtract( Vector3 rhs)
Subtracts rhs from this vector and stores the result in this vector. More...
String toString()
Returns a string describing this Object. More...
Vector3 transform( Matrix4x4 matrix)
Transforms this vector by applying the provided matrix. More...
Vector3 transform_to( Matrix4x4 matrix, Vector3 out)
Transforms this vector by applying the given matrix and copies the result into the out vector. More...
Vector3 transform_transpose( Matrix4x4 matrix)
Transforms this vector by the transpose of the matrix passed in. More...
Vector3 transform_transpose_to( Matrix4x4 matrix, Vector3 out)
Transforms this vector by the transpose of the matrix passed in and copies the result into the out vector. More...

Constructor

RS.​Math.​Vector3( Object vector)

Parameters

vector
Initial value. May be one of the following:
  • Object
  • Array
  • Vector3

Functions

Vector3 RS.​Math.​Vector3.add( Vector3 rhs)

Adds rhs to this vector and stores the result in this vector.

Parameters

rhs
the vector to add.

Returns

this

RS.​Math.​Vector3.clone()

returns a copy of this vector.

Vector3 RS.​Math.​Vector3.cross( Vector3 rhs)

Returns the cross product between this vector and rhs.

Parameters

rhs
Number RS.​Math.​Vector3.distance( Vector3 rhs)

Returns the distance between the point specified by this vector and rhs.

Parameters

rhs
Vector3 RS.​Math.​Vector3.divide( Vector3 rhs)

Divide rhs into this vector and stores the result in this vector.

Parameters

rhs
the vector to multiply.

Returns

this

Number RS.​Math.​Vector3.dot( Vector3 rhs)

Returns the dot product between this vector and rhs.

Parameters

rhs
Boolean RS.​Math.​Vector3.equal( Vector3 rhs, Boolean use_tolerance)

Returns true if this vector equals rhs.

Parameters

rhs
The vector to compare with.
use_tolerance
if supplied and true then use tolerance
Boolean RS.​Math.​Vector3.equal_with_tolerance( Vector3 rhs, Number tolerance)

Returns true if this vector equals rhs using tolerance.

Parameters

rhs
The vector to compare with.
tolerance
The tolerance to use or RS.Math.ALMOST_ZERO if not supplied.
Boolean RS.​Math.​Vector3.is_colinear( Vector3 rhs)

Returns true if this vector and rhs are colinear.

Parameters

rhs

Returns

True if this vector and rhs are colinear

Boolean RS.​Math.​Vector3.is_null_vector( Number tolerance)

Checks if the vector is the null vector.

Parameters

tolerance
Optional. A Number used to approximate the comparison.
Number RS.​Math.​Vector3.length()

Returns the length of this vector.

Vector3 RS.​Math.​Vector3.multiply( Vector3 rhs)

Multiplies rhs with this vector and stores the result in this vector.

Parameters

rhs
the vector to multiply.

Returns

this

Vector3 RS.​Math.​Vector3.normalize()

Normalizes this vector.

Returns

this

Vector3 RS.​Math.​Vector3.rotate( Matrix4x4 matrix)

Rotates this vector by applying the provided matrix.

Parameters

matrix
The matrix to apply.

Returns

this

Vector3 RS.​Math.​Vector3.rotate_to( Matrix4x4 matrix, Vector3 out)

Rotates this vector by applying the provided matrix.

Parameters

matrix
The matrix to apply.
out
Vector to write to

Returns

out

Vector3 RS.​Math.​Vector3.rotate_transpose( Matrix4x4 matrix)

Rotates this vector by the transpose of the provided matrix.

Parameters

matrix
The matrix to apply.

Returns

this

Vector3 RS.​Math.​Vector3.rotate_transpose_to( Matrix4x4 matrix, Vector3 out)

Rotates this vector by the transpose of the provided matrix.

Parameters

matrix
The matrix to apply.
out
Vector to write to

Returns

this

Vector3 RS.​Math.​Vector3.scale( Number scale)

Scales this vector.

Parameters

scale
Scale the scalar to apply.

Returns

this

RS.​Math.​Vector3.set( Object rhs)

Sets this vector from an object. The object may be of the following types: Vector3, and Array with 3 or more members or an Object. In the case of an object it must have the members x, y, and z

Parameters

rhs
The object to set from. May be one of the following:
  • Object
  • Array
  • Vector3
Vector3 RS.​Math.​Vector3.subtract( Vector3 rhs)

Subtracts rhs from this vector and stores the result in this vector.

Parameters

rhs
the vector to subtract.

Returns

this

String RS.​Math.​Vector3.toString()

Returns a string describing this Object.

Returns

A String describing this Object.

Vector3 RS.​Math.​Vector3.transform( Matrix4x4 matrix)

Transforms this vector by applying the provided matrix.

Parameters

matrix
The matrix to apply.

Returns

this

Vector3 RS.​Math.​Vector3.transform_to( Matrix4x4 matrix, Vector3 out)

Transforms this vector by applying the given matrix and copies the result into the out vector.

Parameters

matrix
The matrix to apply.
out
Vector to write to

Returns

the result

Vector3 RS.​Math.​Vector3.transform_transpose( Matrix4x4 matrix)

Transforms this vector by the transpose of the matrix passed in.

Parameters

matrix
The matrix to apply.

Returns

this

Vector3 RS.​Math.​Vector3.transform_transpose_to( Matrix4x4 matrix, Vector3 out)

Transforms this vector by the transpose of the matrix passed in and copies the result into the out vector.

Parameters

matrix
The matrix to apply.
out
Vector to write to

Returns

out