A Vector object for 3d positions.
Kind: global class
Vector3
Vector3
Vector3
Vector3
Vector3
Vector3
Vector3
Vector3
Vector3
Vector3
Vector3
Vector3
Vector3
Vector3
Vector3
Vector3
Vector3
Vector3
Vector3
Boolean
Boolean
Number
Vector3
Number
Number
Vector3
Vector3
Number
Vector3
Vector3
Vector3
Vector3
Array.<Number>
\*
Vector3
Vector3
Vector3
Vector3
Vector3
Vector3
Vector3
Vector3
Vector3
Vector3
Number
Vector3
Vector3
Vector3
Vector3
Create the Vector object.
Param | Type | Default | Description |
---|---|---|---|
x | number |
0 |
Vector X. |
y | number |
0 |
Vector Y. |
z | number |
0 |
Vector Z. |
Vector3
Clone the vector.
Kind: instance method of Vector3
Returns: Vector3
- cloned vector.
Vector3
Set vector value.
Kind: instance method of Vector3
Returns: Vector3
- this.
Param | Type | Description |
---|---|---|
x | Number |
X component. |
y | Number |
Y component. |
z | Number |
Z component. |
Vector3
Copy values from other vector into self.
Kind: instance method of Vector3
Returns: Vector3
- this.
Vector3
Return a new vector of this + other.
Kind: instance method of Vector3
Returns: Vector3
- result vector.
Param | Type | Description |
---|---|---|
Other | Number | Vector3 |
Vector3 or number to add to all components. |
Vector3
Return a new vector of this - other.
Kind: instance method of Vector3
Returns: Vector3
- result vector.
Param | Type | Description |
---|---|---|
Other | Number | Vector3 |
Vector3 or number to sub from all components. |
Vector3
Return a new vector of this / other.
Kind: instance method of Vector3
Returns: Vector3
- result vector.
Param | Type | Description |
---|---|---|
Other | Number | Vector3 |
Vector3 or number to divide by all components. |
Vector3
Return a new vector of this * other.
Kind: instance method of Vector3
Returns: Vector3
- result vector.
Param | Type | Description |
---|---|---|
Other | Number | Vector3 |
Vector3 or number to multiply with all components. |
Vector3
Return a round copy of this vector.
Kind: instance method of Vector3
Returns: Vector3
- result vector.
Vector3
Return a floored copy of this vector.
Kind: instance method of Vector3
Returns: Vector3
- result vector.
Vector3
Return a ceiled copy of this vector.
Kind: instance method of Vector3
Returns: Vector3
- result vector.
Vector3
Return a normalized copy of this vector.
Kind: instance method of Vector3
Returns: Vector3
- result vector.
Vector3
Add other vector values to self.
Kind: instance method of Vector3
Returns: Vector3
- this.
Param | Type | Description |
---|---|---|
Other | Number | Vector3 |
Vector or number to add. |
Vector3
Sub other vector values from self.
Kind: instance method of Vector3
Returns: Vector3
- this.
Param | Type | Description |
---|---|---|
Other | Number | Vector3 |
Vector or number to substract. |
Vector3
Divide this vector by other vector values.
Kind: instance method of Vector3
Returns: Vector3
- this.
Param | Type | Description |
---|---|---|
Other | Number | Vector3 |
Vector or number to divide by. |
Vector3
Multiply this vector by other vector values.
Kind: instance method of Vector3
Returns: Vector3
- this.
Param | Type | Description |
---|---|---|
Other | Number | Vector3 |
Vector or number to multiply by. |
Vector3
Round self.
Kind: instance method of Vector3
Returns: Vector3
- this.
Vector3
Floor self.
Kind: instance method of Vector3
Returns: Vector3
- this.
Vector3
Ceil self.
Kind: instance method of Vector3
Returns: Vector3
- this.
Vector3
Return a normalized copy of this vector.
Kind: instance method of Vector3
Returns: Vector3
- this.
Boolean
Return if vector equals another vector.
Kind: instance method of Vector3
Returns: Boolean
- if vectors are equal.
Param | Type | Description |
---|---|---|
other | Vector3 |
Other vector to compare to. |
Boolean
Return if vector approximately equals another vector.
Kind: instance method of Vector3
Returns: Boolean
- if vectors are equal.
Param | Type | Description |
---|---|---|
other | Vector3 |
Other vector to compare to. |
threshold | Number |
Distance threshold to consider as equal. Defaults to 1. |
Number
Return vector length (aka magnitude).
Kind: instance method of Vector3
Returns: Number
- Vector length.
Vector3
Return a copy of this vector multiplied by a factor.
Kind: instance method of Vector3
Returns: Vector3
- result vector.
Number
Calculate distance between this vector and another vector.
Kind: instance method of Vector3
Returns: Number
- Distance between vectors.
Param | Type | Description |
---|---|---|
other | Vector3 |
Other vector. |
Number
Calculate squared distance between this vector and another vector.
Kind: instance method of Vector3
Returns: Number
- Distance between vectors.
Param | Type | Description |
---|---|---|
other | Vector3 |
Other vector. |
Vector3
Return a clone and clamp its values to be between min and max.
Kind: instance method of Vector3
Returns: Vector3
- Clamped vector.
Param | Type | Description |
---|---|---|
min | Vector3 |
Min vector. |
max | Vector3 |
Max vector. |
Vector3
Clamp this vector values to be between min and max.
Kind: instance method of Vector3
Returns: Vector3
- Self.
Param | Type | Description |
---|---|---|
min | Vector3 |
Min vector. |
max | Vector3 |
Max vector. |
Number
Calculate the dot product with another vector.
Kind: instance method of Vector3
Returns: Number
- Dot product value.
Param | Type | Description |
---|---|---|
other | Vector3 |
Vector to calculate dot with. |
Vector3
Set self values to be min values between self and a given vector.
Kind: instance method of Vector3
Returns: Vector3
- Self.
Param | Type | Description |
---|---|---|
v | Vector3 |
Vector to min with. |
Vector3
Set self values to be max values between self and a given vector.
Kind: instance method of Vector3
Returns: Vector3
- Self.
Param | Type | Description |
---|---|---|
v | Vector3 |
Vector to max with. |
Vector3
Create a clone vector that is the min result between self and a given vector.
Kind: instance method of Vector3
Returns: Vector3
- Result vector.
Param | Type | Description |
---|---|---|
v | Vector3 |
Vector to min with. |
Vector3
Create a clone vector that is the max result between self and a given vector.
Kind: instance method of Vector3
Returns: Vector3
- Result vector.
Param | Type | Description |
---|---|---|
v | Vector3 |
Vector to max with. |
Convert to string.
Kind: instance method of Vector3
Array.<Number>
Convert to array of numbers.
Kind: instance method of Vector3
Returns: Array.<Number>
- Vector components as array.
\*
Convert to dictionary.
Kind: instance method of Vector3
Returns: \*
- Dictionary with {x,y,z}
Param | Type | Description |
---|---|---|
minimized | Boolean |
If true, will not include keys that their values are 0. You can use fromDict on minimized dicts. |
Vector with 0,0,0 values as a frozen shared object. Be careful not to try and change it.
Kind: static property of Vector3
Vector with 1,1,1 values as a frozen shared object. Be careful not to try and change it.
Kind: static property of Vector3
Vector with 0.5,0.5,0.5 values as a frozen shared object. Be careful not to try and change it.
Kind: static property of Vector3
Vector with -1,0,0 values as a frozen shared object. Be careful not to try and change it.
Kind: static property of Vector3
Vector with 1,0,0 values as a frozen shared object. Be careful not to try and change it.
Kind: static property of Vector3
Vector with 0,-1,0 values as a frozen shared object. Be careful not to try and change it.
Kind: static property of Vector3
Vector with 0,1,0 values as a frozen shared object. Be careful not to try and change it.
Kind: static property of Vector3
Vector with 0,0,1 values as a frozen shared object. Be careful not to try and change it.
Kind: static property of Vector3
Vector with 0,0,-1 values as a frozen shared object. Be careful not to try and change it.
Kind: static property of Vector3
Vector3
Get vector with 0,0,0 values.
Kind: static method of Vector3
Returns: Vector3
- result vector.
Vector3
Get vector with 1,1,1 values.
Kind: static method of Vector3
Returns: Vector3
- result vector.
Vector3
Get vector with 0.5,0.5 values.
Kind: static method of Vector3
Returns: Vector3
- result vector.
Vector3
Get vector with -1,0,0 values.
Kind: static method of Vector3
Returns: Vector3
- result vector.
Vector3
Get vector with 1,0,0 values.
Kind: static method of Vector3
Returns: Vector3
- result vector.
Vector3
Get vector with 0,-1,0 values.
Kind: static method of Vector3
Returns: Vector3
- result vector.
Vector3
Get vector with 0,1,0 values.
Kind: static method of Vector3
Returns: Vector3
- result vector.
Vector3
Get vector with 0,0,1 values.
Kind: static method of Vector3
Returns: Vector3
- result vector.
Vector3
Get vector with 0,0,-1 values.
Kind: static method of Vector3
Returns: Vector3
- result vector.
Vector3
Lerp between two vectors.
Kind: static method of Vector3
Returns: Vector3
- result vector.
Param | Type | Description |
---|---|---|
p1 | Vector3 |
First vector. |
p2 | Vector3 |
Second vector. |
a | Number |
Lerp factor (0.0 - 1.0). |
Number
Calculate distance between two vectors.
Kind: static method of Vector3
Returns: Number
- Distance between vectors.
Param | Type | Description |
---|---|---|
p1 | Vector3 |
First vector. |
p2 | Vector3 |
Second vector. |
Vector3
Return cross product between two vectors.
Kind: static method of Vector3
Returns: Vector3
- Crossed vector.
Param | Type | Description |
---|---|---|
p1 | Vector3 |
First vector. |
p2 | Vector3 |
Second vector. |
Vector3
Parse and return a vector object from string in the form of “x,y”.
Kind: static method of Vector3
Returns: Vector3
- Parsed vector.
Param | Type | Description |
---|---|---|
str | String |
String to parse. |
Vector3
Create vector from array of numbers.
Kind: static method of Vector3
Returns: Vector3
- Vector instance.
Param | Type | Description |
---|---|---|
arr | Array.<Number> |
Array of numbers to create vector from. |
Vector3
Create vector from a dictionary.
Kind: static method of Vector3
Returns: Vector3
- Newly created vector.
Param | Type | Description |
---|---|---|
data | \* |
Dictionary with {x,y,z}. |