A 2=dimensional vector.
More...
#include <Vector2.h>
|
float | x |
| The right axis of the vector.
|
|
float | y |
| The upward/forward axis of the vector.
|
|
A 2=dimensional vector.
- Note
- This implementation intentionally avoids the use of x and y
◆ Vector2() [1/4]
A new 2-dimensional zero vector.
◆ Vector2() [2/4]
Passer::LinearAlgebra::Vector2::Vector2 |
( |
float |
right, |
|
|
float |
forward |
|
) |
| |
A new 2-dimensional vector.
- Parameters
-
right | The distance in the right direction in meters |
forward | The distance in the forward direction in meters |
◆ Vector2() [3/4]
Convert a Vector3 to a Vector2.
- Parameters
-
- Note
- This will project the vector to the horizontal plane
◆ Vector2() [4/4]
Passer::LinearAlgebra::Vector2::Vector2 |
( |
Polar |
v | ) |
|
Convert a Polar vector to a 2-dimensional vector.
- Parameters
-
v | The vector in polar coordinates |
◆ ~Vector2()
◆ operator==()
Check if this vector to the given vector.
- Parameters
-
v | The vector to check against |
- Returns
- true if it is identical to the given vector
- Note
- This uses float comparison to check equality which may have strange effects. Equality on floats should be avoided.
◆ Magnitude()
The vector length.
- Parameters
-
v | The vector for which you need the length |
- Returns
- The vector length
◆ magnitude()
float Vector2::magnitude |
( |
| ) |
const |
The vector length.
- Returns
- The vector length
◆ SqrMagnitude()
The squared vector length.
- Parameters
-
v | The vector for which you need the squared length |
- Returns
- The squared vector length
◆ sqrMagnitude()
float Vector2::sqrMagnitude |
( |
| ) |
const |
The squared vector length.
- Returns
- The squared vector length
◆ Normalize()
Convert the vector to a length of 1.
- Parameters
-
- Returns
- The vector normalized to a length of 1
◆ normalized()
Vector2 Vector2::normalized |
( |
| ) |
const |
Convert the vector to a length 1.
- Returns
- The vector normalized to a length of 1
◆ operator-() [1/2]
Negate the vector such that it points in the opposite direction.
- Returns
- The negated vector
◆ operator-() [2/2]
Subtract a vector from this vector.
- Parameters
-
v | The vector to subtract from this vector |
- Returns
- The result of the subtraction
◆ operator-=()
◆ operator+()
Add a vector to this vector.
- Parameters
-
v | The vector to add to this vector |
- Returns
- The result of the addition
◆ operator+=()
◆ Scale()
Scale the vector using another vector.
- Parameters
-
v1 | The vector to scale |
v2 | A vector with the scaling factors |
- Returns
- The scaled vector
◆ operator*=()
◆ operator/=()
◆ Dot()
The dot product of two vectors.
- Parameters
-
v1 | The first vector |
v2 | The second vector |
- Returns
- The dot product of the two vectors
◆ Distance()
The distance between two vectors.
- Parameters
-
v1 | The first vector |
v2 | The second vector |
- Returns
- The distance between the two vectors
◆ Angle()
The angle between two vectors.
- Parameters
-
v1 | The first vector |
v2 | The second vector |
- Returns
- The angle between the two vectors
◆ SignedAngle()
The signed angle between two vectors.
- Parameters
-
v1 | The starting vector |
v2 | The ending vector |
- Returns
- The signed angle between the two vectors
◆ Rotate()
Rotate the vector.
- Parameters
-
v | The vector to rotate |
a | The angle in degrees to rotate |
- Returns
- The rotated vector
◆ Lerp()
Lerp (linear interpolation) between two vectors.
- Parameters
-
v1 | The starting vector |
v2 | The end vector |
f | The interpolation distance |
- Returns
- The lerped vector
◆ Vec2
2-dimensional Vector representation
This is a C-style implementation This uses the right-handed coordinate system.
◆ operator* [1/2]
Scale the vector uniformly up.
- Parameters
-
- Returns
- The scaled vector
◆ operator* [2/2]
◆ operator/ [1/2]
Scale the vector uniformly down.
- Parameters
-
- Returns
- The scaled vector
◆ operator/ [2/2]
◆ zero
A vector with zero for all axis.
◆ one
A vector with one for all axis.
◆ forward
A normalized forward-oriented vector.
◆ back
A normalized back-oriented vector.
◆ right
A normalized right-oriented vector.
◆ left
A normalized left-oriented vector.
◆ up
A normalized up-oriented vector.
- Note
- This is a convenience function which is equal to Vector2::forward
◆ down
A normalized down-oriented vector.
- Note
- This is a convenience function which is equal to Vector2::down
The right axis of the vector.
The upward/forward axis of the vector.
The documentation for this struct was generated from the following files:
- d:/PlatformIO/RoboidControl/LinearAlgebra/Vector2.h
- d:/PlatformIO/RoboidControl/LinearAlgebra/Vector2.cpp