OpenVDB  1.1.0
Classes | Namespaces | Macros | Enumerations | Functions
Math.h File Reference
#include <assert.h>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <cstdlib>
#include <limits>
#include <string>
#include <boost/numeric/conversion/conversion_traits.hpp>
#include <openvdb/Platform.h>
#include <openvdb/version.h>

Go to the source code of this file.

Classes

class  RandomInt
 Simple class to generate random intergers. More...
 
struct  promote< S, T >
 
struct  tolerance< T >
 
struct  tolerance< float >
 
struct  tolerance< double >
 

Namespaces

namespace  openvdb
 
namespace  openvdb::v1_1_0
 
namespace  openvdb::v1_1_0::math
 

Macros

#define OPENVDB_NO_FP_EQUALITY_WARNING_BEGIN
 
#define OPENVDB_NO_FP_EQUALITY_WARNING_END
 
#define OPENVDB_EXACT_IS_APPROX_EQUAL(T)
 

Enumerations

enum  Axis { X_AXIS = 0, Y_AXIS = 1, Z_AXIS = 2 }
 
enum  RotationOrder {
  XYZ_ROTATION = 0, XZY_ROTATION, YXZ_ROTATION, YZX_ROTATION,
  ZXY_ROTATION, ZYX_ROTATION, XZX_ROTATION, ZXZ_ROTATION
}
 

Functions

template<typename T >
zeroVal ()
 
template<>
std::string zeroVal< std::string > ()
 Return the std::string value that corresponds to zero. More...
 
template<>
bool zeroVal< bool > ()
 Return the bool value that corresponds to zero. More...
 
template<typename T >
toleranceValue ()
 
template<>
float toleranceValue< float > ()
 
template<typename T >
negative (const T &val)
 
template<>
bool negative (const bool &val)
 
template<>
std::string negative (const std::string &val)
 Return the "negation" of the given string. More...
 
void randSeed (unsigned int seed)
 ==========> Random Values <================== More...
 
double randUniform ()
 Return random value [0,1]. More...
 
template<typename Type >
Type Clamp (Type x, Type min, Type max)
 Return x clamped to [min, max]. More...
 
template<class Type >
Type Clamp01 (Type x)
 Return x clamped to [0, 1]. More...
 
template<class Type >
bool ClampTest01 (Type &x)
 Return true if x is outside [0,1]. More...
 
template<class Type >
Type SmoothUnitStep (Type x, Type min, Type max)
 Return 0 if x<min, 1 if x>max and else (3-2*t)*t*t, (x-min)/(max-min) More...
 
int32_t Abs (int32_t i)
 Return the absolute value of a signed integer. More...
 
int64_t Abs (int64_t i)
 Return the absolute value of a signed long integer. More...
 
float Abs (float x)
 Return the absolute value of a float. More...
 
double Abs (double x)
 Return the absolute value of a double. More...
 
long double Abs (long double x)
 Return the absolute value of a long double. More...
 
uint32_t Abs (uint32_t i)
 Return the absolute value of a unsigned integer. More...
 
uint64_t Abs (uint64_t i)
 Return the absolute value of a unsigned integer. More...
 
template<typename Type >
bool isZero (const Type &x)
 
template<typename Type >
bool isNegative (const Type &x)
 
template<typename Type >
bool isApproxEqual (const Type &a, const Type &b)
 
template<typename Type >
bool isApproxEqual (const Type &a, const Type &b, const Type &tolerance)
 
template<>
bool isApproxEqual< bool > (const bool &a, const bool &b)
 
template<>
bool isApproxEqual< bool > (const bool &a, const bool &b, const bool &)
 
template<>
bool isApproxEqual< std::string > (const std::string &a, const std::string &b)
 
template<>
bool isApproxEqual< std::string > (const std::string &a, const std::string &b, const std::string &)
 
template<typename T0 , typename T1 >
bool isExactlyEqual (const T0 &a, const T1 &b)
 
template<typename Type >
bool isRelOrApproxEqual (const Type &a, const Type &b, const Type &absTol, const Type &relTol)
 
template<>
bool isRelOrApproxEqual (const bool &a, const bool &b, const bool &, const bool &)
 
int32_t floatToInt32 (const float aFloatValue)
 
int64_t doubleToInt64 (const double aDoubleValue)
 
bool isUlpsEqual (const double aLeft, const double aRight, const int64_t aUnitsInLastPlace)
 
bool isUlpsEqual (const float aLeft, const float aRight, const int32_t aUnitsInLastPlace)
 
template<typename Type >
Type Pow2 (Type x)
 Return x to the power of two, i.e. x*x. More...
 
template<typename Type >
Type Pow3 (Type x)
 Return x to the power of three, i.e. x*x*x. More...
 
template<typename Type >
Type Pow4 (Type x)
 Return x to the power of four, i.e. x*x*x*x. More...
 
template<typename Type >
Type Pow (Type x, int n)
 Return x to the power of n, i.e. x^n. More...
 
float Pow (float b, float e)
 Return b to the power of e, i.e. b^e. More...
 
double Pow (double b, double e)
 Return b to the power of e, i.e. b^e. More...
 
template<typename Type >
const Type & Max (const Type &a, const Type &b)
 Return the maximum of two values. More...
 
template<typename Type >
const Type & Max (const Type &a, const Type &b, const Type &c)
 Return the maximum of three values. More...
 
template<typename Type >
const Type & Max (const Type &a, const Type &b, const Type &c, const Type &d)
 Return the maximum of four values. More...
 
template<typename Type >
const Type & Max (const Type &a, const Type &b, const Type &c, const Type &d, const Type &e)
 Return the maximum of five values. More...
 
template<typename Type >
const Type & Max (const Type &a, const Type &b, const Type &c, const Type &d, const Type &e, const Type &f)
 Return the maximum of six values. More...
 
template<typename Type >
const Type & Max (const Type &a, const Type &b, const Type &c, const Type &d, const Type &e, const Type &f, const Type &g)
 Return the maximum of seven values. More...
 
template<typename Type >
const Type & Max (const Type &a, const Type &b, const Type &c, const Type &d, const Type &e, const Type &f, const Type &g, const Type &h)
 Return the maximum of eight values. More...
 
template<typename Type >
const Type & Min (const Type &a, const Type &b)
 Return the minimum of two values. More...
 
template<typename Type >
const Type & Min (const Type &a, const Type &b, const Type &c)
 Return the minimum of three values. More...
 
template<typename Type >
const Type & Min (const Type &a, const Type &b, const Type &c, const Type &d)
 Return the minimum of four values. More...
 
template<typename Type >
const Type & Min (const Type &a, const Type &b, const Type &c, const Type &d, const Type &e)
 Return the minimum of five values. More...
 
template<typename Type >
const Type & Min (const Type &a, const Type &b, const Type &c, const Type &d, const Type &e, const Type &f)
 Return the minimum of six values. More...
 
template<typename Type >
const Type & Min (const Type &a, const Type &b, const Type &c, const Type &d, const Type &e, const Type &f, const Type &g)
 Return the minimum of seven values. More...
 
template<typename Type >
const Type & Min (const Type &a, const Type &b, const Type &c, const Type &d, const Type &e, const Type &f, const Type &g, const Type &h)
 Return the minimum of eight values. More...
 
template<typename Type >
int Sign (const Type &x)
 Return the sign of a variable as an integer. The three cases are -1, 0 or 1. More...
 
float Sqrt (float x)
 Return square-root of a floating point. More...
 
double Sqrt (double x)
 
long double Sqrt (long double x)
 
int Mod (int i, int j)
 Return remainder of x/y = Mod. More...
 
float Mod (float x, float y)
 
double Mod (double x, double y)
 
long double Mod (long double x, long double y)
 
template<typename Type >
Type Reminder (Type x, Type y)
 Return reminder of x/y. More...
 
float RoundUp (float x)
 Return round up to nearest integer or base. More...
 
double RoundUp (double x)
 
long double RoundUp (long double x)
 
template<typename Type >
Type RoundUp (Type x, Type base)
 
float RoundDown (float x)
 Return rounds down to nearest integer or base. More...
 
double RoundDown (double x)
 
long double RoundDown (long double x)
 
template<typename Type >
Type RoundDown (Type x, Type base)
 
template<typename Type >
Type IntegerPart (Type x)
 Return integer part. More...
 
template<typename Type >
Type FractionalPart (Type x)
 Return fractional part. More...
 
int Floor (float x)
 Return floor. More...
 
int Floor (double x)
 
int Floor (long double x)
 
int Ceil (float x)
 Return ceil. More...
 
int Ceil (double x)
 
int Ceil (long double x)
 
template<typename Type >
Type Round (Type x)
 Return rounds off x to nearest integer value. More...
 
template<typename Type >
Type Chop (Type x, Type delta)
 Return chop of x. More...
 
template<typename Type >
Type Truncate (Type x, unsigned int digits)
 Return truncation of x to smoe digits. More...
 
template<typename Type >
Type Inv (Type x)
 Return inverse of x. More...
 
std::string operator+ (const std::string &s, bool)
 Needed to support the (zeroVal<ValueType>() + val) idiom when ValueType is std::string. More...
 
std::string operator+ (const std::string &s, int)
 Needed to support the (zeroVal<ValueType>() + val) idiom when ValueType is std::string. More...
 
std::string operator+ (const std::string &s, float)
 Needed to support the (zeroVal<ValueType>() + val) idiom when ValueType is std::string. More...
 
std::string operator+ (const std::string &s, double)
 Needed to support the (zeroVal<ValueType>() + val) idiom when ValueType is std::string. More...
 

Detailed Description

Author
Ken Museth

Macro Definition Documentation

#define OPENVDB_EXACT_IS_APPROX_EQUAL (   T)
Value:
template<> inline bool isApproxEqual<T>(const T& a, const T& b) { return a == b; } \
template<> inline bool isApproxEqual<T>(const T& a, const T& b, const T&) { return a == b; } \
#define OPENVDB_NO_FP_EQUALITY_WARNING_BEGIN
#define OPENVDB_NO_FP_EQUALITY_WARNING_END