#include <algorithm>
#include <cstdlib>
#include <cml/constants.h>
Go to the source code of this file.
Namespaces | |
namespace | cml |
Functions | |
template<typename T > | |
T | cml::acos_safe (T theta) |
Wrap std::acos() and clamp argument to [-1, 1]. | |
template<typename T > | |
T | cml::asin_safe (T theta) |
Wrap std::asin() and clamp argument to [-1, 1]. | |
template<typename T > | |
T | cml::clamp (T value, T min, T max) |
Clamp input value to the range [min, max]. | |
template<typename T > | |
T | cml::cub (T value) |
Cube a value. | |
void | cml::cyclic_permutation (size_t first, size_t &i, size_t &j, size_t &k, size_t &l) |
Cyclic permutation of the set { 0, 1, 2, 3 }, starting with 'first'. | |
void | cml::cyclic_permutation (size_t first, size_t &i, size_t &j, size_t &k) |
Cyclic permutation of the set { 0, 1, 2 }, starting with 'first'. | |
void | cml::cyclic_permutation (size_t first, size_t &i, size_t &j) |
Cyclic permutation of the set { 0, 1 }, starting with 'first'. | |
template<typename T > | |
T | cml::deg (T theta) |
Convert radians to degrees. | |
template<typename T > | |
T | cml::fov_to_zoom (T fov) |
Convert field of view to zoom factor. | |
template<typename T > | |
bool | cml::in_range (T value, T min, T max) |
Test input value for inclusion in [min, max]. | |
template<typename T > | |
size_t | cml::index_of_max (T a, T b, T c) |
Index of maximum of 3 values. | |
template<typename T > | |
size_t | cml::index_of_max (T a, T b) |
Index of maximum of 2 values. | |
template<typename T > | |
size_t | cml::index_of_max_abs (T a, T b, T c) |
Index of maximum of 3 values by magnitude. | |
template<typename T > | |
size_t | cml::index_of_max_abs (T a, T b) |
Index of maximum of 2 values by magnitude. | |
template<typename T > | |
size_t | cml::index_of_min (T a, T b, T c) |
Index of minimum of 3 values. | |
template<typename T > | |
size_t | cml::index_of_min (T a, T b) |
Index of minimum of 2 values. | |
template<typename T > | |
size_t | cml::index_of_min_abs (T a, T b, T c) |
Index of minimum of 3 values by magnitude. | |
template<typename T > | |
size_t | cml::index_of_min_abs (T a, T b) |
Index of minimum of 2 values by magnitude. | |
template<typename T > | |
T | cml::inv_sqrt (T value) |
Inverse square root. | |
template<typename T > | |
T | cml::length (T x, T y, T z) |
Length in R3. | |
template<typename T > | |
T | cml::length (T x, T y) |
Length in R2. | |
template<typename T > | |
T | cml::length_squared (T x, T y, T z) |
Squared length in R3. | |
template<typename T > | |
T | cml::length_squared (T x, T y) |
Squared length in R2. | |
template<typename T > | |
T | cml::map_range (T value, T min1, T max1, T min2, T max2) |
Map input value from [min1, max1] to [min2, max2]. | |
size_t | cml::next (size_t i, size_t N) |
Return next, with cycling, in a series of N non-negative integers. | |
size_t | cml::prev (size_t i, size_t N) |
Return previous, with cycling, in a series of N non-negative integers. | |
template<typename T > | |
T | cml::rad (T theta) |
Convert degrees to radians. | |
size_t | cml::random_binary () |
Random binary (0,1) value. | |
long | cml::random_integer (long min, long max) |
int | cml::random_polar () |
Random polar (-1,1) value. | |
template<typename T > | |
T | cml::random_real (T min, T max) |
double | cml::random_unit () |
Random real in [0,1]. | |
template<typename T > | |
double | cml::sign (T value) |
Sign of input value as double. | |
template<typename T > | |
T | cml::sqr (T value) |
Square a value. | |
template<typename T > | |
T | cml::sqrt_safe (T value) |
Wrap std::sqrt() and clamp argument to [0, inf). | |
template<typename T > | |
T | cml::wrap (T value, T min, T max) |
Wrap input value to the range [min,max]. | |
template<typename T > | |
T | cml::xfov_to_yfov (T xfov, T aspect) |
Convert horizontal field of view to vertical field of view. | |
template<typename T > | |
T | cml::xzoom_to_yzoom (T xzoom, T aspect) |
Convert horizontal zoom to vertical zoom. | |
template<typename T > | |
T | cml::yfov_to_xfov (T yfov, T aspect) |
Convert vertical field of view to horizontal field of view. | |
template<typename T > | |
T | cml::yzoom_to_xzoom (T yzoom, T aspect) |
Convert vertical zoom to horizontal zoom. | |
template<typename T > | |
T | cml::zoom_to_fov (T zoom) |
Convert zoom factor to field of view. |
Definition in file util.h.