Go to the documentation of this file. 1 #ifndef EAGINE_MATH_COORDINATES_HPP
9 #define EAGINE_MATH_COORDINATES_HPP
11 #include "../quantities.hpp"
12 #include "../valid_if/nonnegative.hpp"
13 #include "../valid_if/positive.hpp"
22 template <
typename T,
bool V>
52 template <
typename T,
bool V>
57 cos(c.azimuth()) * abs(cos(c.elevation())),
59 -sin(c.azimuth()) * abs(cos(c.elevation())));
64 template <
typename T,
bool V>
69 return abs(v.y()) > T(0) ? R(-arctan(v.z(), v.x()), arcsin(v.y()))
75 #endif // EAGINE_MATH_COORDINATES_HPP
auto to_unit_spherical(vector< T, 3, V > v) noexcept -> unit_spherical_coordinate< T, V >
Converts cartesian vector to unit spherical coordinate.
Definition: coordinates.hpp:65
constexpr unit_spherical_coordinate(radians_t< T > azimuth, radians_t< T > elevation) noexcept
Constructor initializing the azimuth and elevation.
Definition: coordinates.hpp:29
auto to_cartesian(unit_spherical_coordinate< T, V > c) noexcept -> vector< T, 3, V >
Converts unit spherical coordinate to cartesian vector.
Definition: coordinates.hpp:53
Math-related code is placed in this namespace.
Definition: eagine.hpp:48
Class representing unit spherical coordinate.
Definition: coordinates.hpp:23
auto azimuth() const noexcept -> radians_t< T >
Returns the azimuth.
Definition: coordinates.hpp:36
auto elevation() const noexcept -> radians_t< T >
Returns the elevation.
Definition: coordinates.hpp:41
constexpr unit_spherical_coordinate() noexcept=default
Default constructor.
Value of type T with a specified unit or tag type U.
Definition: tagged_quantity.hpp:27