Spherical namespace
#include <darts/spherical.h>
Working with spherical coordinate and angles.
Functions
- auto rad2deg(float value) -> float
- Convert radians to degrees.
- auto deg2rad(float value) -> float
- Convert degrees to radians.
-
template<typename T>auto sincos(T arg) -> std::pair<T, T>
- Return the sine and cosine in a single function call.
-
template<typename T>auto theta(const Vec3<T>& v) -> T
-
template<typename T>auto cos_theta(const Vec3<T>& v) -> T
-
template<typename T>auto sin_theta(const Vec3<T>& v) -> T
-
template<typename T>auto tan_theta(const Vec3<T>& v) -> T
-
template<typename T>auto sin_theta2(const Vec3<T>& v) -> T
-
template<typename T>auto phi(const Vec3<T>& v) -> T
-
template<typename T>auto sin_phi(const Vec3<T>& v) -> T
-
template<typename T>auto cos_phi(const Vec3<T>& v) -> T
-
template<typename T>auto sin_phi2(const Vec3<T>& v) -> T
-
template<typename T>auto cos_phi2(const Vec3<T>& v) -> T
-
template<typename T>auto spherical_coordinates_to_direction(const Vec2<T>& phi_theta) -> Vec3<T>
- Convert spherical (phi,theta) coordinates to a unit direction in Cartesian coordinates.
-
template<typename T>auto direction_to_spherical_coordinates(const Vec3<T>& v) -> Vec2<T>
- Convert a unit direction from Cartesian coordinates to spherical (phi,theta) coordinates.
Function documentation
template<typename T>
std::pair<T, T> Spherical:: sincos(T arg)
Return the sine and cosine in a single function call.
template<typename T>
T Spherical:: sin_theta2(const Vec3<T>& v)
Parameters | |
---|---|
v in | Unit direction vector in local coordinates |
Returns | T Squared sine of the angle between the local z axis and v |
template<typename T>
Vec3<T> Spherical:: spherical_coordinates_to_direction(const Vec2<T>& phi_theta)
Convert spherical (phi,theta) coordinates to a unit direction in Cartesian coordinates.
Parameters | |
---|---|
phi_theta in | The spherical angles with and . and . |
Returns | The corresponding unit-length direction vector in Cartesian coordinates. |
template<typename T>
Vec2<T> Spherical:: direction_to_spherical_coordinates(const Vec3<T>& v)
Convert a unit direction from Cartesian coordinates to spherical (phi,theta) coordinates.
Parameters | |
---|---|
v in | The direction vector in Cartesian coordinates (assumed to be unit length) |
Returns | The spherical angles with and . and . |