LinearAlgebra
|
A spherical vector using angles in various representations.
T | The implementation type used for the representations of the agles |
#include <Spherical.h>
Public Member Functions | |
SphericalOf (float distance, AngleOf< T > horizontal, AngleOf< T > vertical) | |
SphericalOf (float distance, DirectionOf< T > direction) | |
Vector3 | ToVector3 () const |
Convert the spherical coordinate to a Vector3 coordinate. | |
SphericalOf< T > | WithDistance (float distance) |
Update the distance component of the spherical coordinate. | |
SphericalOf< T > | operator- () const |
Negate the vector. | |
SphericalOf< T > | operator- (const SphericalOf< T > &v) const |
Subtract a spherical vector from this vector. | |
SphericalOf< T > | operator-= (const SphericalOf< T > &v) |
SphericalOf< T > | operator+ (const SphericalOf< T > &v) const |
Add a spherical vector to this vector. | |
SphericalOf< T > | operator+= (const SphericalOf< T > &v) |
SphericalOf< T > | operator*= (float f) |
SphericalOf< T > | operator/= (float f) |
Static Public Member Functions | |
static SphericalOf< T > | Degrees (float distance, float horizontal, float vertical) |
Create spherical vector without using AngleOf type. All given angles are in degrees. | |
static SphericalOf< T > | Radians (float distance, float horizontal, float vertical) |
Create sperical vector without using the AngleOf type. All given angles are in radians. | |
static SphericalOf< T > | FromPolar (PolarOf< T > v) |
Create a Spherical coordinate from a Polar coordinate. | |
static SphericalOf< T > | FromVector3 (Vector3 v) |
Create a Spherical coordinate from a Vector3 coordinate. | |
static float | DistanceBetween (const SphericalOf< T > &v1, const SphericalOf< T > &v2) |
Calculate the distance between two spherical coordinates. | |
static AngleOf< T > | AngleBetween (const SphericalOf< T > &v1, const SphericalOf< T > &v2) |
Calculate the unsigned angle between two spherical vectors. | |
static AngleOf< T > | SignedAngleBetween (const SphericalOf< T > &v1, const SphericalOf< T > &v2, const SphericalOf< T > &axis) |
Calculate the signed angle between two spherical vectors. | |
static SphericalOf< T > | Rotate (const SphericalOf &v, AngleOf< T > horizontalAngle, AngleOf< T > verticalAngle) |
Rotate a spherical vector. | |
static SphericalOf< T > | RotateHorizontal (const SphericalOf< T > &v, AngleOf< T > angle) |
Rotate a spherical vector horizontally. | |
static SphericalOf< T > | RotateVertical (const SphericalOf< T > &v, AngleOf< T > angle) |
Rotate a spherical vector vertically. | |
Public Attributes | |
float | distance |
The distance in meters. | |
DirectionOf< T > | direction |
The angle in the horizontal plane in degrees, clockwise rotation. | |
Static Public Attributes | |
static constexpr auto | Deg = Degrees |
Short-hand Deg alias for the Degrees function. | |
static constexpr auto | Rad = Radians |
static const SphericalOf< T > | zero |
A spherical vector with zero degree angles and distance. | |
static const SphericalOf< T > | forward |
A normalized forward-oriented vector. | |
static const SphericalOf< T > | back |
A normalized back-oriented vector. | |
static const SphericalOf< T > | right |
A normalized right-oriented vector. | |
static const SphericalOf< T > | left |
A normalized left-oriented vector. | |
static const SphericalOf< T > | up |
A normalized up-oriented vector. | |
static const SphericalOf< T > | down |
A normalized down-oriented vector. | |
Friends | |
SphericalOf< T > | operator* (const SphericalOf< T > &v, float f) |
Scale the vector uniformly up. | |
SphericalOf< T > | operator* (float f, const SphericalOf< T > &v) |
SphericalOf< T > | operator/ (const SphericalOf< T > &v, float f) |
Scale the vector uniformly down. | |
SphericalOf< T > | operator/ (float f, const SphericalOf< T > &v) |
|
static |
Create spherical vector without using AngleOf type. All given angles are in degrees.
distance | The distance in meters |
horizontal | The horizontal angle in degrees |
vertical | The vertical angle in degrees |
|
static |
Create sperical vector without using the AngleOf type. All given angles are in radians.
distance | The distance in meters |
horizontal | The horizontal angle in radians |
vertical | The vertical angle in radians |
Create a Spherical coordinate from a Polar coordinate.
v | The polar coordinate |
|
static |
Create a Spherical coordinate from a Vector3 coordinate.
v | The vector coordinate |
Convert the spherical coordinate to a Vector3 coordinate.
Converts spherical coordinates to a 3D vector.
This function converts the spherical coordinates represented by the SphericalOf object to a 3D vector (Vector3). The conversion is based on the distance and direction (vertical and horizontal angles) of the spherical coordinates.
T | The type of the distance and direction values. |
SphericalOf< T > SphericalOf::WithDistance | ( | float | distance | ) |
Update the distance component of the spherical coordinate.
distance | The new distance |
SphericalOf< T > SphericalOf::operator- | ( | ) | const |
Negate the vector.
SphericalOf< T > Passer::LinearAlgebra::SphericalOf< T >::operator- | ( | const SphericalOf< T > & | v | ) | const |
Subtract a spherical vector from this vector.
v | The vector to subtract |
SphericalOf< T > SphericalOf::operator+ | ( | const SphericalOf< T > & | v | ) | const |
Add a spherical vector to this vector.
v | The vector to add |
|
static |
Calculate the distance between two spherical coordinates.
v1 | The first coordinate |
v2 | The second coordinate |
|
static |
Calculate the unsigned angle between two spherical vectors.
v1 | The first vector |
v2 | The second vector |
|
static |
Calculate the signed angle between two spherical vectors.
v1 | The first vector |
v2 | The second vector |
axis | The axis are which the angle is calculated |
|
static |
Rotate a spherical vector.
v | The vector to rotate |
horizontalAngle | The horizontal rotation angle in local space |
verticalAngle | The vertical rotation angle in local space |
|
static |
Rotate a spherical vector horizontally.
v | The vector to rotate |
angle | The horizontal rotation angle in local space |
|
static |
Rotate a spherical vector vertically.
v | The vector to rotate |
angle | The vertical rotation angle in local space |
|
friend |
Scale the vector uniformly up.
f | The scaling factor |
|
friend |
Scale the vector uniformly down.
f | The scaling factor |
float Passer::LinearAlgebra::SphericalOf< T >::distance |
The distance in meters.
DirectionOf<T> Passer::LinearAlgebra::SphericalOf< T >::direction |
The angle in the horizontal plane in degrees, clockwise rotation.
The angle is automatically normalized to -180 .. 180
The angle in the vertical plane in degrees. Positive is upward.
The angle is automatically normalized to -180 .. 180
|
static |
A spherical vector with zero degree angles and distance.
|
static |
A normalized forward-oriented vector.
|
static |
A normalized back-oriented vector.
|
static |
A normalized right-oriented vector.
|
static |
A normalized left-oriented vector.
|
static |
A normalized up-oriented vector.
|
static |
A normalized down-oriented vector.