Two dimensional immutable vector.
| Parameters: |
|---|
Compare vectors for approximate equality.
| Parameters: |
|
|---|---|
| Returns: | True if distance between the vectors < EPSILON. |
Compute the smallest angle from this vector to another.
| Parameters: |
|
|---|---|
| Returns: | Angle in degrees in the range (-180, 180]. |
| Return type: | float |
Compute a vector in the same direction with a bounded length. If min_length <= self.length <= max_length then the original vector is returned.
| Parameters: | |
|---|---|
| Return type: | Vec2 |
Compute the cross product with another vector.
| Parameters: |
|
|---|---|
| Returns: | The length of the cross-product vector |
| Return type: | float |
Compute the distance to another point vector.
| Parameters: |
|
|---|---|
| Return type: | float |
Compute the dot product with another vector.
| Parameters: |
|
|---|---|
| Return type: | float |
Compute a vector by linear interpolation between this vector and another.
| Parameters: |
|
|---|---|
| Return type: | Vec2 |
Return the vector scaled to unit length. If the vector is null, the null vector is returned.
| Return type: | Vec2 |
|---|
Compute the perpendicular vector.
| Return type: | Vec2 |
|---|
Create a vector from polar coordinates.
| Parameters: | |
|---|---|
| Return type: | Vec2 |
Compute the projection of another vector onto this one.
| Parameters: |
|
|---|---|
| Return type: | Vec2 |
Compute the reflection of this vector against another.
| Parameters: |
|
|---|---|
| Return type: | Vec2 |
Compute the vector rotated by an angle.
| Parameters: |
|
|---|---|
| Return type: | Vec2 |
Compute the vector scaled to a given length. If the vector is null, the null vector is returned.
| Parameters: |
|
|---|---|
| Return type: | Vec2 |
The angle the vector makes to the positive x axis in the range (-180, 180].
Flag indicating if the vector is effectively zero-length.
| Returns: | True if the vector length < EPSILON. |
|---|
The length or scalar magnitude of the vector.
The square of the length of the vector.
The horizontal coordinate.
The vertical coordinate.