A 3-dimensional vector.
More...
#include <Vector3.h>
|
static float | Magnitude (const Vector3 &v) |
| The vector length.
|
|
static float | SqrMagnitude (const Vector3 &v) |
| The squared vector length.
|
|
static Vector3 | Normalize (const Vector3 &v) |
| Convert the vector to a length of 1.
|
|
static Vector3 | Scale (const Vector3 &v1, const Vector3 &v2) |
| Scale the vector using another vector.
|
|
static float | Distance (const Vector3 &v1, const Vector3 &v2) |
| The distance between two vectors.
|
|
static float | Dot (const Vector3 &v1, const Vector3 &v2) |
| The dot product of two vectors.
|
|
static Vector3 | Cross (const Vector3 &v1, const Vector3 &v2) |
| The cross product of two vectors.
|
|
static Vector3 | Project (const Vector3 &v, const Vector3 &n) |
| Project the vector on another vector.
|
|
static Vector3 | ProjectOnPlane (const Vector3 &v, const Vector3 &n) |
| Project the vector on a plane defined by a normal orthogonal to the plane.
|
|
static float | Angle (const Vector3 &v1, const Vector3 &v2) |
| The angle between two vectors.
|
|
static float | SignedAngle (const Vector3 &v1, const Vector3 &v2, const Vector3 &axis) |
| The signed angle between two vectors.
|
|
static Vector3 | Lerp (const Vector3 &v1, const Vector3 &v2, float f) |
| Lerp (linear interpolation) between two vectors.
|
|
|
static const Vector3 | zero = Vector3(0, 0, 0) |
| A vector with zero for all axis.
|
|
static const Vector3 | one = Vector3(1, 1, 1) |
| A vector with one for all axis.
|
|
static const Vector3 | forward = Vector3(0, 0, 1) |
| A normalized forward-oriented vector.
|
|
static const Vector3 | back = Vector3(0, 0, -1) |
| A normalized back-oriented vector.
|
|
static const Vector3 | right = Vector3(1, 0, 0) |
| A normalized right-oriented vector.
|
|
static const Vector3 | left = Vector3(-1, 0, 0) |
| A normalized left-oriented vector.
|
|
static const Vector3 | up = Vector3(0, 1, 0) |
| A normalized up-oriented vector.
|
|
static const Vector3 | down = Vector3(0, -1, 0) |
| A normalized down-oriented vector.
|
|
|
float | x |
| The right axis of the vector.
|
|
float | y |
| The upward axis of the vector.
|
|
float | z |
| The forward axis of the vector.
|
|
A 3-dimensional vector.
- Note
- This implementation intentionally avoids the use of x, y and z values.
◆ Vector3() [1/4]
A new 3-dimensional zero vector.
◆ Vector3() [2/4]
A new 3-dimensional vector.
- Parameters
-
right | The distance in the right direction in meters |
up | The distance in the upward direction in meters |
forward | The distance in the forward direction in meters |
◆ Vector3() [3/4]
Convert a 2-dimenstional vector to a 3-dimensional vector.
- Parameters
-
◆ Vector3() [4/4]
Passer::LinearAlgebra::Vector3::Vector3 |
( |
Spherical |
v | ) |
|
Convert vector in spherical coordinates to 3d carthesian coordinates.
- Parameters
-
◆ ~Vector3()
◆ Forward()
float Passer::LinearAlgebra::Vector3::Forward |
( |
| ) |
const |
|
inline |
◆ Up()
float Passer::LinearAlgebra::Vector3::Up |
( |
| ) |
const |
|
inline |
◆ Right()
float Passer::LinearAlgebra::Vector3::Right |
( |
| ) |
const |
|
inline |
◆ 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 Vector3::magnitude |
( |
| ) |
const |
The vector length.
- Returns
- The vector length
◆ SqrMagnitude()
The squared vector length.
- Parameters
-
v | The vector for which you need the length |
- Returns
- The squared vector length
◆ sqrMagnitude()
float Vector3::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()
Vector3 Vector3::normalized |
( |
| ) |
const |
Convert the vector to a length of 1.
- Returns
- The vector normalized to a length of 1
◆ operator-() [1/2]
Vector3 Vector3::operator- |
( |
| ) |
const |
Negate te 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 this 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/=()
◆ Distance()
The distance between two vectors.
- Parameters
-
v1 | The first vector |
v2 | The second vector |
- Returns
- The distance between the two vectors
◆ Dot()
The dot product of two vectors.
- Parameters
-
v1 | The first vector |
v2 | The second vector |
- Returns
- The dot product of the two vectors
◆ Cross()
The cross product of two vectors.
- Parameters
-
v1 | The first vector |
v2 | The second vector |
- Returns
- The cross product of the two vectors
◆ Project()
Project the vector on another vector.
- Parameters
-
v | The vector to project |
n | The normal vecto to project on |
- Returns
- The projected vector
◆ ProjectOnPlane()
Project the vector on a plane defined by a normal orthogonal to the plane.
- Parameters
-
v | The vector to project |
n | The normal of the plane to project on |
- Returns
- Teh projected vector
◆ 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 |
axis | The axis to rotate around |
- Returns
- The signed angle between the two vectors
◆ Lerp()
Lerp (linear interpolation) between two vectors.
- Parameters
-
v1 | The starting vector |
v2 | The ending vector |
f | The interpolation distance |
- Returns
- The lerped vector
◆ Vec3
3-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.
◆ down
A normalized down-oriented vector.
float Passer::LinearAlgebra::Vec3::x |
|
protectedinherited |
The right axis of the vector.
float Passer::LinearAlgebra::Vec3::y |
|
protectedinherited |
The upward axis of the vector.
float Passer::LinearAlgebra::Vec3::z |
|
protectedinherited |
The forward axis of the vector.
The documentation for this struct was generated from the following files:
- d:/PlatformIO/RoboidControl/LinearAlgebra/Vector3.h
- d:/PlatformIO/RoboidControl/LinearAlgebra/Vector3.cpp