All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
g3dmath.h File Reference
#include "G3D/platform.h"
#include <ctype.h>
#include <float.h>
#include <limits>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <math.h>
#include "G3D/debug.h"
+ Include dependency graph for g3dmath.h:

Go to the source code of this file.




#define _ISOC9X_SOURCE1
#define _ISOC99_SOURCE1
#define __USE_ISOC9X1
#define __USE_ISOC991
#define G3D_DECLARE_SYMBOL(s)   static const std::string SYMBOL_##s = #s
#define fuzzyEpsilon64   (0.0000005)
#define fuzzyEpsilon32   (0.00001f)


typedef int8_t G3D::int8
typedef uint8_t G3D::uint8
typedef int16_t G3D::int16
typedef uint16_t G3D::uint16
typedef int32_t G3D::int32
typedef uint32_t G3D::uint32
typedef int64_t G3D::int64
typedef uint64_t G3D::uint64
typedef float G3D::float32
typedef double G3D::float64


double G3D::inf ()
double G3D::nan ()
float G3D::finf ()
float G3D::fnan ()
double G3D::pi ()
float G3D::pif ()
double G3D::halfPi ()
double G3D::twoPi ()
int G3D::iAbs (int iValue)
int G3D::iCeil (double fValue)
int G3D::iClamp (int val, int low, int hi)
int16 G3D::iClamp (int16 val, int16 low, int16 hi)
double G3D::clamp (double val, double low, double hi)
float G3D::clamp (float val, float low, float hi)
double G3D::lerp (double a, double b, double f)
float G3D::lerp (float a, float b, float f)
int G3D::iWrap (int val, int hi)
int G3D::iFloor (double fValue)
int G3D::iSign (int iValue)
int G3D::iSign (double fValue)
int G3D::iSign (float f)
double G3D::round (double f)
float G3D::round (float f)
int G3D::iRound (double fValue)
int G3D::iRound (float f)
int G3D::iRandom (int low, int hi)
double G3D::abs (double fValue)
double G3D::aCos (double fValue)
double G3D::aSin (double fValue)
double G3D::aTan (double fValue)
double G3D::aTan2 (double fY, double fX)
double G3D::sign (double fValue)
double G3D::square (double fValue)
bool G3D::isFinite (double x)
bool G3D::isNaN (double x)
bool G3D::isNaN (float x)
bool G3D::isNaN (int x)
bool G3D::isNaN (uint64 x)
int G3D::iMod3 (int x)
float G3D::uniformRandom (float low=0.0f, float hi=1.0f)
float G3D::gaussRandom (float mean=0.0f, float stdev=1.0f)
template<class T >
G3D::pow5 (T x)
template<class T >
G3D::min (const T &x, const T &y)
template<class T >
G3D::min (const T &x, const T &y, const T &z)
template<class T >
G3D::min (const T &x, const T &y, const T &z, const T &w)
template<class T >
G3D::max (const T &x, const T &y)
template<class T >
G3D::max (const T &x, const T &y, const T &z)
template<class T >
G3D::max (const T &x, const T &y, const T &z, const T &w)
int G3D::iMin (int x, int y)
int G3D::iMax (int x, int y)
double G3D::sumSquares (double x, double y)
double G3D::sumSquares (double x, double y, double z)
double G3D::distance (double x, double y)
double G3D::distance (double x, double y, double z)
int G3D::highestBit (uint32 x)
bool G3D::fuzzyEq (double a, double b)
bool G3D::fuzzyNe (double a, double b)
bool G3D::fuzzyGt (double a, double b)
bool G3D::fuzzyGe (double a, double b)
bool G3D::fuzzyLt (double a, double b)
bool G3D::fuzzyLe (double a, double b)
float G3D::rsq (float x)
int G3D::ceilPow2 (unsigned int in)
int G3D::pow2 (unsigned int x)
double G3D::log2 (double x)
float G3D::log2 (float x)
double G3D::log2 (int x)
bool G3D::isPow2 (int num)
bool G3D::isPow2 (uint64 num)
bool G3D::isOdd (int num)
bool G3D::isEven (int num)
double G3D::toRadians (double deg)
double G3D::toDegrees (double rad)
bool G3D::any (float x)
bool G3D::all (float x)
float G3D::normalize (float v)
float G3D::dot (float a, float b)
float G3D::mul (float a, float b)
double G3D::exp2 (double x)
float G3D::exp2 (float x)
double G3D::rsqrt (double x)
float G3D::rsqrt (float x)
double G3D::sinc (double x)
float G3D::wrap (float t, float lo, float hi)
double G3D::wrap (double t, double lo, double hi)
double G3D::wrap (double t, double hi)
bool G3D::isFinite (float x)
float G3D::acos (float fValue)
float G3D::sign (float fValue)
float G3D::square (float x)
int G3D::square (int x)
float G3D::sumSquares (float x, float y)
float G3D::sumSquares (float x, float y, float z)
float G3D::distance (float x, float y)
float G3D::distance (float x, float y, float z)
bool G3D::isPow2 (uint32 x)
float G3D::toRadians (float deg)
float G3D::toDegrees (float rad)
float G3D::toRadians (int deg)
float G3D::toDegrees (int rad)
double G3D::eps (double a, double b)
float G3D::eps (float a, float b)
bool G3D::fuzzyEq (float a, float b)
uint32 G3D::flipEndian32 (const uint32 x)
uint16 G3D::flipEndian16 (const uint16 x)
float G3D::smoothstep (float edge0, float edge1, float x)
float G3D::smootherstep (float edge0, float edge1, float x)
float G3D::signedPow (float b, float e)
double G3D::signedPow (double b, double e)
int std::pow (int a, int b)

Detailed Description

Math util class.

Morgan McGuire, [highestBit] by Jukka Liimatta

2001-06-02 2013-01-27

Copyright 2000-2013, Morgan McGuire. All rights reserved.

Macro Definition Documentation

#define __USE_ISOC991
#define __USE_ISOC9X1
#define _ISOC99_SOURCE1
#define _ISOC9X_SOURCE1
#define fuzzyEpsilon32   (0.00001f)
#define fuzzyEpsilon64   (0.0000005)
#define G3D_DECLARE_SYMBOL (   s)    static const std::string SYMBOL_##s = #s

Defines SYMBOL_s as a static const std::string with the value s. Useful for avoiding heap allocation from C-string constants being converted at runtime.