constructor
new Vec3(_x, _y, _z)
Constructor function for 2d vectors
| Name | Type | Description |
|---|---|---|
| _x | real |
The x component of the vector. |
| _y | real |
The y component of the vector. |
| _z | real |
The z component of the vector. |
| Name | Description |
|---|---|
| x | The x component of the vector. |
| y | The y component of the vector. |
| z | The z component of the vector. |
| Name | Description |
|---|---|
| add | Adds the specified vector to this vector. |
| add_new | Adds the specified vector to this vector. |
| angle_to | Calculates the angle from self to another vector. |
| cmpeq | Performs a vertical == comparison between self and _vector. |
| cmpge | Performs a vertical >= comparison between self and _vector. |
| cmpgt | Performs a vertical > comparison between self and _vector. |
| cmple | Performs a vertical <= comparison between self and _vector. |
| cmplt | Performs a vertical < comparison between self and _vector. |
| cmpne | Performs a vertical != comparison between self and _vector. |
| cross | Returns the cross product of this vector and the specified vector. |
| distance | Calculates the distance between self and another vector |
| dot | Returns the dot product of this vector and the specified vector. |
| is_normalized | Checks whether self is normalized. |
| length | Calculates the length of self. |
| length_squared | Calculates the square of the length of self. |
| lerpy | Linearly interpolates between two points. Interpolates between the points self and _finish by the interpolant _amt. The parameter _amt is clamped to the range [0, 1]. |
| max_element | Calculates the horizontal maximum of self's elements. |
| max_elements | Calculates the vertical maximum of self's and _vector's elements. |
| min_element | Calculates the horizontal minimum of self's elements. |
| min_elements | Calculates the vertical minimum of self's and _vector's elements. |
| normalize | Normalizes the vector |
| one | Creates a Vec2 with all elements set to 1. |
| ortho | Returns a new orthogonal vector |
| scalar_div | Divides every component of the vector by a scalar. |
| scalar_mul | Multiplies every component of the vector with a scalar. |
| set | Replaces all three components of the vector with new ones. |
| sub | Substracts the specified vector from this vector. |
| sub_new | Substracts the specified vector from this vector. |
| to_string | Converts the components of self to a string. |
| unit_x | Creates a Vec3 with values { x: 1, y: 0, z : 0 }. |
| unit_y | Creates a Vec3 with values { x: 0, y: 1, z : 0 }. |
| unit_z | Creates a Vec3 with values { x: 0, y: 0, z : 1 }. |
| zero | Creates a Vec3 with all elements set to 0. |
vec1 = new Vec3(2, 5, 10);
Copyright © 2020, eL-Falso. Built on December 14, 2020 using GMDoc.