Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

nvmath.h File Reference

#include "nvsgcommon.h"
#include <algorithm>
#include <float.h>
#include "__WIN64__workarounds.h"

Include dependency graph for nvmath.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  nvmath

Functions

template<class T>
clamp (T v, T l, T u)
 Template to clamp an object of type T to a lower and an upper limit.
float degToRad (float angle)
 Transform an angle in degrees to radians.
bool isPowerOfTwo (int n)
 Determine if an integer is a power of two.
template<typename T>
lerp (float alpha, const T &v0, const T &v1)
 Linear interpolation between two values v0 and v1.
int powerOfTwoBelow (int n)
 Determine the largest integer power of two below an integer.
float radToDeg (float angle)
 Transform an angle in radian to degree.
template<typename T>
int sign (const T &t)
 Determine the sign of a scalar.
template<typename T>
float square (const T &t)
 Template to square an object of Type T.

Variables

const float PI = 3.14159265358979323846f
 constant PI
const float PI_HALF = 1.57079632679489661923f
 constant PI half
const float PI_QUARTER = 0.78539816339744830962f
 constant PI quarter
const float SQRT_TWO = 1.41421356237309504880f
 constant square root two
const float SQRT_TWO_HALF = 0.70710678118654752440f
 constant square root two half


Detailed Description


Function Documentation

template<class T>
T clamp v,
l,
u
 

Template to clamp an object of type T to a lower and an upper limit.

Returns:
clamped value of v between l and u
Parameters:
v  value to clamp
l  lower limit
u  upper limit

float degToRad float  angle  )  [inline]
 

Transform an angle in degrees to radians.

Returns:
angle in radians
Parameters:
angle  angle in degrees

bool isPowerOfTwo int  n  )  [inline]
 

Determine if an integer is a power of two.

Returns:
true if n is a power of two, otherwise false
Parameters:
n  integer to test

template<typename T>
T lerp float  alpha,
const T &  v0,
const T &  v1
 

Linear interpolation between two values v0 and v1.

v = v0 + alpha * ( v1 - v0 )

Parameters:
alpha  interpolation parameter
v0  starting value
v1  ending value

int powerOfTwoBelow int  n  )  [inline]
 

Determine the largest integer power of two below an integer.

Returns:
largest power of two below n
Parameters:
n  integer to use as the upper limit

float radToDeg float  angle  )  [inline]
 

Transform an angle in radian to degree.

Returns:
angle in degrees
Parameters:
angle  angle in radians

template<typename T>
int sign const T &  t  ) 
 

Determine the sign of a scalar.

Returns:
sign of t
Parameters:
t  scalar value

template<typename T>
float square const T &  t  ) 
 

Template to square an object of Type T.

Returns:
product of t with itself
Parameters:
t  object to square


Variable Documentation

const float nvmath::PI = 3.14159265358979323846f
 

constant PI

const float nvmath::PI_HALF = 1.57079632679489661923f
 

constant PI half

const float nvmath::PI_QUARTER = 0.78539816339744830962f
 

constant PI quarter

const float nvmath::SQRT_TWO = 1.41421356237309504880f
 

constant square root two

const float nvmath::SQRT_TWO_HALF = 0.70710678118654752440f
 

constant square root two half


Generated on Tue Mar 1 13:19:45 2005 for NVSGSDK by NVIDIA