-
Notifications
You must be signed in to change notification settings - Fork 1
Vec2
Hyomoto edited this page Jun 24, 2021
·
14 revisions
Jump To | Go Back |
Arguments | Methods | Variables |
---|
A simple, garbage-collected two-dimensional vector.
var _vec2 = new Vec2( 32, 20 );
Output: A new Vec2 is created with an x of 32 and a y of 20
Name | Type | Purpose |
---|---|---|
x | real |
The x position in this vector |
y | real |
The y position in this vector |
Jump To | top |
set | len | lensqr | add | subtract | multiply | divide | dot | cross | dist_to | dist_to_sqr | normalize | to_array | toString |
---|
Returns: self
Name | Type | Purpose |
---|---|---|
x | real |
The x position to set this vector |
y | real |
The y position to set this vector |
Used to set both the x and y coordinates in this vector with a single method.
Returns: real
Name | Type | Purpose |
---|---|---|
None |
Used to get the vectors length.
Returns: real
Name | Type | Purpose |
---|---|---|
None |
Used to get the vectors squared length.
Returns: Vec2
Name | Type | Purpose |
---|---|---|
Vec2 | Vec2 | The vector to subtract from this one. |
No description.
Returns: Vec2
Name | Type | Purpose |
---|---|---|
Vec2 | Vec2 | The vector to subtract from this one. |
No description.
Returns: Vec2
Name | Type | Purpose |
---|---|---|
Vec2 | Vec2 | The vector to multiply this one component wise with. |
No description.
Returns: Vec2
Name | Type | Purpose |
---|---|---|
Vec2 | Vec2 | The vector to divide this one one component wise by. |
No description.
Returns: real
Name | Type | Purpose |
---|---|---|
Vec2 | Vec2 | The vector to get the dot product with. |
No description.
Returns: Vec2
Name | Type | Purpose |
---|---|---|
Vec2 | Vec2 | The vector to get the cross product with. |
No description.
Returns: real
Name | Type | Purpose |
---|---|---|
Vec2 | Vec2 | The vector to get the distance to. |
No description.
Returns: real
Name | Type | Purpose |
---|---|---|
Vec2 | Vec2 | The vector to get the squared distance to. |
No description.
Returns: Vec2
Name | Type | Purpose |
---|---|---|
None |
Used to normalise the vector to unit length.
Returns: array
Name | Type | Purpose |
---|---|---|
None |
Returns this vector as an array.
Name | Type | Purpose |
---|---|---|
None |
Returns this vector as a comma-separated string value pair.
Jump To | top |
---|
Name | Type | Initial | Purpose |
---|---|---|---|
x | real |
_x | the x position of this vector |
y | real |
_y | the y position of this vector |
Devon Mullane 2020