Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
utils.h File Reference
#include <algorithm>
#include <cmath>
#include "base/integral_types.h"
Include dependency graph for utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 ion
 Copyright 2016 Google Inc.
 
 ion::math
 

Functions

template<typename T >
bool ion::math::IsFinite (T x)
 Tests whether a numeric value is finite. More...
 
template<typename T >
const T ion::math::Abs (const T &val)
 Returns the absolute value of a number in a type-safe way. More...
 
template<typename T >
const T ion::math::Square (const T &val)
 Squares a value. More...
 
template<typename T >
T ion::math::Sqrt (const T &val)
 Returns the square root of a value. More...
 
template<>
float ion::math::Sqrt (const float &val)
 
template<typename T >
T ion::math::Cosine (T angle)
 Returns the cosine of the given value. More...
 
template<>
float ion::math::Cosine (float angle)
 float specialization of Cosine. More...
 
template<typename T >
T ion::math::Sine (T angle)
 Returns the sine of the given value. More...
 
template<>
float ion::math::Sine (float angle)
 float specialization of Sine. More...
 
template<typename T >
T ion::math::Tangent (T angle)
 Returns the tangent of the given value. More...
 
template<>
float ion::math::Tangent (float angle)
 float specialization of Tangent. More...
 
template<typename T >
T ion::math::Factorial (int x)
 Returns the factorial (!) of x. More...
 
template<typename T >
T ion::math::DoubleFactorial (int x)
 Returns the double factorial (!!) of x. More...
 
uint32 ion::math::NextPowerOf2 (uint32 n)
 Returns the next power of 2 greater than or equal to n. More...
 
uint64 ion::math::NextPowerOf2 (uint64 n)
 
template<typename T >
T ion::math::Log2 (T n)
 Returns the base-2 logarithm of n. More...
 
template<>
uint32 ion::math::Log2 (uint32 n)
 Specialize for integer types. More...
 
template<>
int ion::math::Log2 (int n)
 
template<>
uint64 ion::math::Log2 (uint64 n)
 
template<>
int64 ion::math::Log2 (int64 n)
 
template<typename T >
const T ion::math::Clamp (const T &val, const T &min_val, const T &max_val)
 Clamps a value to lie between a minimum and maximum, inclusive. More...
 
template<typename T , typename U >
const U ion::math::Lerp (const U &begin, const U &end, const T &t)
 Linearly interpolates between two values. More...
 
bool ion::math::IsPowerOfTwo (int value)
 Returns true if a value is a power of two. More...