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
|
- Source:
Returns:
(static) unitX() → {syngen.utility.vector3d}
Instantiates a unit vector along the x-axis.
- Source:
Returns:
(static) unitY() → {syngen.utility.vector3d}
Instantiates a unit vector along the y-axis.
- Source:
Returns:
(static) unitZ() → {syngen.utility.vector3d}
Instantiates a unit vector along the z-axis.
- Source:
Returns:
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:
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:
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:
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:
quaternion() → {syngen.utility.quaternion}
Calculates the quaternion between this and the positive x-axis.
- Source:
Returns:
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:
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:
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:
set(optionsopt)
Sets all properties with options
.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
syngen.utility.vector3d | Object |
<optional> |
Properties
|
- 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: