XY (2D) Vectors
FloatVector2
Bases: BaseVector2
2D Float Vector Array.
Create a new 2D, float-based vector array.
| PARAMETER | DESCRIPTION |
|---|---|
x
|
Coordinate on the X-axis.
TYPE:
|
y
|
Coordinate on the Y-axis.
TYPE:
|
copy
copy() -> FloatVector2
Copy this vector into another instance of the same vector.
| RETURNS | DESCRIPTION |
|---|---|
FloatVector2
|
This vector as another instance. |
dot
dot(other: FloatVector2) -> float
Calculate the dot product of this vector with another.
| PARAMETER | DESCRIPTION |
|---|---|
other
|
The other vector to calculate the dot product with.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
The dot product of these two vectors. |
from_iterable
classmethod
from_iterable(
iterable: Union[
FloatVector2,
IntVector2,
np.ndarray[np.float32],
tuple[Union[int, float], Union[int, float]],
list[Union[int, float]],
],
) -> FloatVector2
Create a new 2D, float-based vector array from an iterable with 2 float or int values.
| PARAMETER | DESCRIPTION |
|---|---|
iterable
|
The iterable with 3
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
FloatVector2
|
The new 2D, |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the provided iterable contains more or less than 2 values |
normalize
normalize() -> FloatVector2
Normalize this vector.
| RETURNS | DESCRIPTION |
|---|---|
FloatVector2
|
The normalized vector. |
| RAISES | DESCRIPTION |
|---|---|
ZeroDivisionError
|
If the magnitude of this vector is 0 |
to_numpy
Return this vector as an instance of a NumPy array.
| PARAMETER | DESCRIPTION |
|---|---|
copy
|
If this method should return a copy of the internal
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
numpy.ndarray[numpy.int32]
|
This vector as an instance of a |
Warning
If you return the array itself, any changes to that array will change this vector object.
to_tuple
IntVector2
Bases: BaseVector2
2D Integer Vector Array.
Create a new 2D, int-based vector array.
| PARAMETER | DESCRIPTION |
|---|---|
x
|
Coordinate on the X-axis.
TYPE:
|
y
|
Coordinate on the Y-axis.
TYPE:
|
copy
copy() -> IntVector2
Copy this vector into another instance of the same vector.
| RETURNS | DESCRIPTION |
|---|---|
IntVector2
|
This vector as another instance. |
dot
dot(other: IntVector2) -> float
Calculate the dot product of this vector with another.
| PARAMETER | DESCRIPTION |
|---|---|
other
|
The other vector to calculate the dot product with.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
The dot product of these two vectors. |
from_iterable
classmethod
from_iterable(
iterable: Union[
IntVector2,
np.ndarray[np.int32],
tuple[int, int],
list[int],
],
) -> IntVector2
Create a new 2D, int-based vector array from an iterable with 2 int values.
| PARAMETER | DESCRIPTION |
|---|---|
iterable
|
The iterable with 2
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
IntVector2
|
The new 2D, |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the provided iterable contains more or less than 2 values |
normalize
normalize() -> FloatVector2
Normalize this vector.
| RETURNS | DESCRIPTION |
|---|---|
FloatVector2
|
The normalized vector. |
| RAISES | DESCRIPTION |
|---|---|
ZeroDivisionError
|
If the magnitude of this vector is 0 |
to_numpy
Return this vector as an instance of a NumPy array.
| PARAMETER | DESCRIPTION |
|---|---|
copy
|
If this method should return a copy of the internal
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
numpy.ndarray[numpy.int32]
|
This vector as an instance of a |
Warning
If you return the array itself, any changes to that array will change this vector object.