Constructor
new MenuVector(arguments)
Parameters:
Name | Type | Description |
---|---|---|
arguments |
Object | Tuple:.<number:, number:> | number | An object representing x and y, a tuple of x and y, or an arg list of x and y. |
- Source:
Members
length :number
The length of this vector.
Type:
- number
- Source:
(private) x :number
X position. (Call this.#x)
Type:
- number
- Source:
(readonly) x
Return module:menulib~MenuVector#x
- Source:
(private) y :number
Y position.
Type:
- number
- Source:
(readonly) y
Return module:menulib~MenuVector#y
- Source:
Methods
add(arguments) → {MenuVector}
Add arguments to self.
Parameters:
Name | Type | Description |
---|---|---|
arguments |
Object | Tuple:.<number:, number:> | number | An object representing x and y, a tuple of x and y, or an arg list of x and y. |
- Source:
Returns:
Self.
- Type
- MenuVector
dist(otherVector) → {number}
Parameters:
Name | Type | Description |
---|---|---|
otherVector |
MenuVector |
- Source:
Returns:
The distance between this vector and otherVector.
- Type
- number
dot(otherVector) → {number}
Parameters:
Name | Type | Description |
---|---|---|
otherVector |
MenuVector |
- Source:
Returns:
Dot product of the two vectors.
- Type
- number
normalized() → {MenuVector}
Normalize self.
- Source:
Returns:
self.
- Type
- MenuVector
scalarMul(scalar) → {MenuVector}
Multiply x and y by scalar.
Parameters:
Name | Type | Description |
---|---|---|
scalar |
number |
- Source:
Returns:
self.
- Type
- MenuVector
sub(arguments) → {MenuVector}
Subtract arguments from self.
Parameters:
Name | Type | Description |
---|---|---|
arguments |
Object | Tuple:.<number:, number:> | number | An object representing x and y, a tuple of x and y, or an arg list of x and y. |
- Source:
Returns:
Self.
- Type
- MenuVector
(static) add(vec1, vec2) → {MenuVector}
Add two vectors together.
Parameters:
Name | Type | Description |
---|---|---|
vec1 |
MenuVector | |
vec2 |
MenuVector |
- Source:
Returns:
- Type
- MenuVector
(static) normalized(vec1) → {MenuVector}
Return a normalized vector.
Parameters:
Name | Type | Description |
---|---|---|
vec1 |
MenuVector |
- Source:
Returns:
- Type
- MenuVector
(static) scalarMul(vec1, scalar) → {MenuVector}
Multiply vec1 by scalar.
Parameters:
Name | Type | Description |
---|---|---|
vec1 |
MenuVector | |
scalar |
number |
- Source:
Returns:
- Type
- MenuVector
(static) sub(vec1, vec2) → {MenuVector}
Subtract vec2 from vec1.
Parameters:
Name | Type | Description |
---|---|---|
vec1 |
MenuVector | |
vec2 |
MenuVector |
- Source:
Returns:
- Type
- MenuVector