-
Notifications
You must be signed in to change notification settings - Fork 0
Class Vector2
Moderr edited this page Feb 28, 2023
·
1 revision
class Vector2
Structure represents 2D positions and vectors.
Constructs a new Vector2 with the given coordinates.
Params:
number
x - X-coordinate (Default: 0)
number
y - Y-coordinate (Default: 0)
x
- X-coordinate.
y
- Y-coordinate.
Method | Description |
---|---|
getX() | Gets the X-coordinate. |
getY() | Gets the Y-coordinate. |
setX(newX) | Sets the X-coordinate. |
setY(newY) | Sets the Y-coordinate. |
addX(x) | Adds the x to X-coordinate. |
addY(y) | Adds the y to Y-coordinate. |
add(v) | Adds the vector by another. |
subtract(v) | Performs subtraction components from the other vector components. |
multiply(scalar) | Performs scalar multiplication, multiplying all components with scalar. |
divide(scalar) | Performs scalar divination, dividing all components with scalar. |
distance(v) | Gets the distance between this vector and another. |
W.I.P