Interface: vector3d

syngen.utility.vector3d

Provides an interface for two-dimensional vectors with x-y-z coordinates.

Source:
See:

Members

x :Number

Position along the x-axis.

Type:
  • Number
Source:

y :Number

Position along the y-axis.

Type:
  • Number
Source:

z :Number

Position along the y-axis.

Type:
  • Number
Source:

Methods

(static) create(optionsopt) → {syngen.utility.vector3d}

Instantiates a new three-dimensional vector.

Parameters:
Name Type Attributes Default Description
options syngen.utility.vector3d | Object <optional>
{}
Properties
Name Type Attributes Default Description
x Number <optional>
0
y Number <optional>
0
z Number <optional>
0
Source:
Returns:
Type
syngen.utility.vector3d

(static) unitX() → {syngen.utility.vector3d}

Instantiates a unit vector along the x-axis.

Source:
Returns:
Type
syngen.utility.vector3d

(static) unitY() → {syngen.utility.vector3d}

Instantiates a unit vector along the y-axis.

Source:
Returns:
Type
syngen.utility.vector3d

(static) unitZ() → {syngen.utility.vector3d}

Instantiates a unit vector along the z-axis.

Source:
Returns:
Type
syngen.utility.vector3d

add(vectoropt) → {syngen.utility.vector3d|Object}

Adds vector to this and returns their sum as a new instance.

Parameters:
Name Type Attributes Description
vector syngen.utility.vector3d | Object <optional>
Source:
Returns:
Type
syngen.utility.vector3d | Object

clone() → {syngen.utility.vector3d}

Returns a new instance with the same properties.

Source:
Returns:
Type
syngen.utility.vector3d

crossProduct(vectoropt) → {syngen.utility.vector3d}

Calculates the cross product with vector. This operation is noncommunicative.

Parameters:
Name Type Attributes Description
vector syngen.utility.vector3d | Object <optional>
Source:
Returns:
Type
syngen.utility.vector3d

distance(vectoropt) → {Number}

Calculates the Euclidean distance from vector.

Parameters:
Name Type Attributes Description
vector syngen.utility.vector3d | Object <optional>
Source:
Returns:
Type
Number

distance2(vectoropt) → {Number}

Calculates the squared Euclidean distance from vector.

Parameters:
Name Type Attributes Description
vector syngen.utility.vector3d | Object <optional>
Source:
Returns:
Type
Number

dotProduct(vectoropt) → {Number}

Calculates the dot product with vector.

Parameters:
Name Type Attributes Description
vector syngen.utility.vector3d | Object <optional>
Source:
Returns:
Type
Number

equals(vectoropt) → {Boolean}

Returns whether this is equal to vector.

Parameters:
Name Type Attributes Description
vector syngen.utility.vector3d | Object <optional>
Source:
Returns:
Type
Boolean

euler() → {syngen.utility.euler}

Calculates the Euler angle between this and the positive x-axis.

Source:
Returns:
Type
syngen.utility.euler

inverse() → {syngen.utility.vector3d}

Returns the inverse vector as a new instance.

Source:
Returns:
Type
syngen.utility.vector3d

isZero() → {Boolean}

Returns whether this represents the origin.

Source:
Returns:
Type
Boolean

normalize() → {syngen.utility.vector3d}

Scales this by its distance to return a unit vector as a new instance.

Source:
Returns:
Type
syngen.utility.vector3d

quaternion() → {syngen.utility.quaternion}

Calculates the quaternion between this and the positive x-axis.

Source:
Returns:
Type
syngen.utility.quaternion

rotateEuler(euler, sequenceopt) → {syngen.utility.vector3d}

Rotates this by euler with sequence and returns it as a new instance. Beware that this is less performant than using quaternions and can result in gimbal lock.

Parameters:
Name Type Attributes Description
euler syngen.utility.euler
sequence String <optional>
Source:
Returns:
Type
syngen.utility.vector3d

rotateQuaternion(quaternion) → {syngen.utility.vector3d}

Rotates this by quaternion and returns it as a new instance.

Parameters:
Name Type Description
quaternion syngen.utility.quaternion
Source:
Returns:
Type
syngen.utility.vector3d

scale(scalaropt) → {syngen.utility.vector3d}

Multiplies this by scalar and returns it as a new instance.

Parameters:
Name Type Attributes Default Description
scalar Number <optional>
0
Source:
Returns:
Type
syngen.utility.vector3d

set(optionsopt)

Sets all properties with options.

Parameters:
Name Type Attributes Description
options syngen.utility.vector3d | Object <optional>
Properties
Name Type Attributes Default Description
x Number <optional>
0
y Number <optional>
0
z Number <optional>
0
Source:

subtract(vectoropt) → {syngen.utility.vector3d|Object}

Subtracts vector from this and returns their difference as a new instance.

Parameters:
Name Type Attributes Description
vector syngen.utility.vector3d | Object <optional>
Source:
Returns:
Type
syngen.utility.vector3d | Object

subtractRadius(radiusopt) → {syngen.utility.vector3d}

Subtracts a spherical radius from this and returns it as a new instance.

Parameters:
Name Type Attributes Default Description
radius Number <optional>
0
Source:
Returns:
Type
syngen.utility.vector3d