LinearAlgebra
|
A polar vector using an angle in various representations.
T | The implementation type used for the representation of the angle |
#include <Polar.h>
Public Member Functions | |
PolarOf () | |
A new vector with polar coordinates with zero degrees and distance. | |
PolarOf (float distance, AngleOf< T > angle) | |
A new vector with polar coordinates. | |
bool | operator== (const PolarOf &v) const |
Equality test to another vector. | |
float | magnitude () const |
The vector length. | |
PolarOf | normalized () const |
Convert the vector to a length of a. | |
PolarOf | operator- () const |
Negate the vector. | |
PolarOf | operator- (const PolarOf &v) const |
Subtract a polar vector from this vector. | |
PolarOf | operator-= (const PolarOf &v) |
PolarOf | operator+ (const PolarOf &v) const |
Add a polar vector to this vector. | |
PolarOf | operator+= (const PolarOf &v) |
PolarOf | operator*= (float f) |
PolarOf | operator/= (float f) |
Static Public Member Functions | |
static PolarOf< T > | Degrees (float distance, float degrees) |
Create polar vector without using AngleOf type. All given angles are in degrees. | |
static PolarOf< T > | Radians (float distance, float radians) |
Create polar vector without using AngleOf type. All given angles are in radians. | |
static PolarOf< T > | FromVector2 (Vector2 v) |
Convert a vector from 2D carthesian coordinates to polar coordinates. | |
static PolarOf< T > | FromSpherical (SphericalOf< T > v) |
Convert a vector from spherical coordinates to polar coordinates. | |
static float | Magnitude (const PolarOf &v) |
The vector length. | |
static PolarOf | Normalize (const PolarOf &v) |
Convert the vector to a length of 1. | |
static float | Distance (const PolarOf &v1, const PolarOf &v2) |
The distance between two vectors. | |
static PolarOf | Rotate (const PolarOf &v, AngleOf< T > a) |
Rotate a vector. | |
Public Attributes | |
float | distance |
The distance in meters. | |
AngleOf< T > | angle |
The angle 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 |
Short-hand Rad alias for the Radians function. | |
static const PolarOf | zero = PolarOf(0.0f, AngleOf<T>()) |
A polar vector with zero degrees and distance. | |
static const PolarOf | forward = PolarOf(1.0f, AngleOf<T>()) |
A normalized forward-oriented vector. | |
static const PolarOf | back = PolarOf(1.0, AngleOf<T>::Degrees(180)) |
A normalized back-oriented vector. | |
static const PolarOf | right = PolarOf(1.0, AngleOf<T>::Degrees(90)) |
A normalized right-oriented vector. | |
static const PolarOf | left = PolarOf(1.0, AngleOf<T>::Degrees(-90)) |
A normalized left-oriented vector. | |
Friends | |
PolarOf | operator* (const PolarOf &v, float f) |
Scale the vector uniformly up. | |
PolarOf | operator* (float f, const PolarOf &v) |
PolarOf | operator/ (const PolarOf &v, float f) |
Scale the vector uniformly down. | |
PolarOf | operator/ (float f, const PolarOf &v) |
A new vector with polar coordinates.
distance | The distance in meters |
angle | The angle in degrees, clockwise rotation |
Create polar vector without using AngleOf type. All given angles are in degrees.
distance | The distance in meters |
degrees | The angle in degrees |
Create polar vector without using AngleOf type. All given angles are in radians.
distance | The distance in meters |
radians | The angle in radians |
Convert a vector from 2D carthesian coordinates to polar coordinates.
v | The vector to convert |
Convert a vector from spherical coordinates to polar coordinates.
s | The vector to convert |
Equality test to another vector.
v | The vector to check against |
The vector length.
v | The vector for which you need the length |
|
inline |
The vector length.
Convert the vector to a length of 1.
v | The vector to convert |
Convert the vector to a length of a.
Negate the vector.
Subtract a polar vector from this vector.
v | The vector to subtract |
Add a polar vector to this vector.
v | The vector to add |
The distance between two vectors.
v1 | The first vector |
v2 | The second vector |
Rotate a vector.
v | The vector to rotate |
a | The angle in degreesto rotate |
Scale the vector uniformly up.
f | The scaling factor |
Scale the vector uniformly down.
f | The scaling factor |
float Passer::LinearAlgebra::PolarOf< T >::distance |
The distance in meters.
The angle in degrees clockwise rotation.