57 template <
class T>
static T Sqrt(T val) {
return sqrt(val);}
59 template <
class T>
static T
Abs(T val) {
return fabs(val);}
60 static int Abs(
int val) {
if (val>0)
return val;
else return -val;}
61 template <
class T>
static T
Sin(T val) {
return sin(val);}
62 template <
class T>
static T
Cos(T val) {
return cos(val);}
63 template <
class T>
static T
Tan(T val) {
return tan(val);}
69 template <
class T>
static T
Squared(T val) {
return val*val;}
71 template <
class T>
static int NumDigits(T val);
72 template <
class T>
static double GetNormalizedValueRespectingLength(T val);
75 static bool isEqual(
int32 lhs,
int32 rhs,
int32 tolerance=std::numeric_limits<int32>::epsilon());
77 static bool isEqual(
uint32 lhs,
uint32 rhs,
uint32 tolerance=std::numeric_limits<uint32>::epsilon());
78 static bool isEqual(
float32 lhs,
float32 rhs,
float32 tolerance=std::numeric_limits<float32>::epsilon());
79 static bool isEqual(
float64 lhs,
float64 rhs,
float64 tolerance=std::numeric_limits<float64>::epsilon());
83 static float32 unitRandom32(
void);
85 static float64 unitRandom64(
void);
87 static int rangeRandom(
int iLow,
int iHigh);
90 static bool randomBool(
void);
98 static bool isPowerOf2(
uint32 i);
105 static std::string formatBytes(uint64_t sizeInBytes);
108 template <
class T>
static T clamp(T val, T minval, T maxval);
118 template <
class T>
static T lerp( T a, T b, T t );
125 template <
class T>
static DtVector3<T> toCartesian(T thetaDegrees, T phiDegrees,
bool flipYZ);
128 template <
class T>
static bool linePlaneIntersection(
const DtVector3<T>& linePoint1,
const DtVector3<T>& linePoint2,
134 template <
class T>
static bool isFinite(T n);
136 template <
class T>
static T Min(T lhs, T rhs);
137 template <
class T>
static T Max(T lhs, T rhs);
140 static double fractional(
double val);
145 static unsigned int tilelog2(
unsigned int x);
149 static T rpmToRadiansPerSec(T rpm);
153 static T radiansPerSecToRpm(T radiansPerSec);
157 template <
class T>
static T
positiveInfinity(
void) {
return std::numeric_limits<T>::max();}
158 template <
class T>
static T
negativeInfinity(
void) {
return std::numeric_limits<T>::min();}
175 Assert(minval <= maxval &&
"Invalid clamp range");
176 return std::max(std::min(val, maxval), minval);
222 T vm = va + (vb - va) * t;
240 vm[0] = va[0] + (vb[0] - va[0]) * t;
241 vm[1] = va[1] + (vb[1] - va[1]) * t;
260 vm[0] = va[0] + (vb[0] - va[0]) * t;
261 vm[1] = va[1] + (vb[1] - va[1]) * t;
262 vm[2] = va[2] + (vb[2] - va[2]) * t;
281 vm[0] = va[0] + (vb[0] - va[0]) * t;
282 vm[1] = va[1] + (vb[1] - va[1]) * t;
283 vm[2] = va[2] + (vb[2] - va[2]) * t;
284 vm[3] = va[3] + (vb[3] - va[3]) * t;
292 T theta = toRadians(thetaDegrees);
293 T phi = toRadians(phiDegrees);
302 T temp = vPosition.
y;
303 vPosition.
y = vPosition.
z;
329 intersect = (lineDir * w) + linePoint1;
347 double normalizedValue = (
double)(val)/(
double)(std::numeric_limits<T>::max());
348 return normalizedValue;
355 && (n != +std::numeric_limits<T>::infinity())
356 && (n != -std::numeric_limits<T>::infinity())
395 return (radiansPerSec / (2.0f *
DtMath::PI)) * 60.0f;
static T clamp(T val, T minval, T maxval)
Clamping routines.
Definition: DtMath.h:173
static const float32 PI
Definition: DtMath.h:161
static T Sin(T val)
Standard math routines.
Definition: DtMath.h:61
DtRadians(float32 fVal)
Definition: DtMath.h:41
static T Squared(T val)
Standard math routines.
Definition: DtMath.h:69
virtual ~DtRadians()
Definition: DtMath.h:42
T x
Definition: DtVector4.h:118
float32 myVal
Definition: DtMath.h:48
static const float32 PI_BY_3
Definition: DtMath.h:163
static double GetNormalizedValueRespectingLength(T val)
Standard math routines.
Definition: DtMath.h:345
static T Cos(T val)
Standard math routines.
Definition: DtMath.h:62
static const float32 PI_BY_6
Definition: DtMath.h:165
DtDegrees(float32 fVal)
Definition: DtMath.h:28
T dotProduct(const DtVector3 &rhs) const
get the dot product of this vector and rhs
Definition: DtVector3.h:268
float32 val() const
Definition: DtMath.h:43
static T negativeInfinity(void)
Definition: DtMath.h:158
static T radiansPerSecToRpm(T radiansPerSec)
radians per sec to rpm
Definition: DtMath.h:393
static const float32 PI_BY_4
Definition: DtMath.h:164
static bool isFinite(T n)
Definition: DtMath.h:352
T y
Definition: DtVector2.h:105
T z
Definition: DtVector3.h:135
static const float32 TWO_PI
Definition: DtMath.h:160
static int NumDigits(T val)
Standard math routines.
Definition: DtMath.h:334
T x
Definition: DtVector3.h:135
DtDegrees()
Definition: DtMath.h:34
static T lerp(T a, T b, T t)
Lerping routines.
Definition: DtMath.h:210
static bool linePlaneIntersection(const DtVector3< T > &linePoint1, const DtVector3< T > &linePoint2, const DtVector3< T > &planePoint, const DtVector3< T > &planeNormal, DtVector3< T > &intersect, float &w)
Basic intersections.
Definition: DtMath.h:311
static const float32 m_fConvertToDegrees
Definition: DtMath.h:168
4 dimensional vector
Definition: DtMath.h:22
static T Tan(T val)
Standard math routines.
Definition: DtMath.h:63
static DtVector3< T > toCartesian(T thetaDegrees, T phiDegrees, bool flipYZ)
Definition: DtMath.h:290
static int Abs(int val)
Standard math routines.
Definition: DtMath.h:60
float float32
Definition: DtCommonTypes.h:33
T z
Definition: DtVector4.h:118
static T Max(T lhs, T rhs)
Definition: DtMath.h:374
static const float32 PI_BY_2
Definition: DtMath.h:162
T w
Definition: DtVector4.h:118
T y
Definition: DtVector3.h:135
static T positiveInfinity(void)
Definition: DtMath.h:157
DtRadians()
Definition: DtMath.h:47
Math utilities.
Definition: DtMath.h:53
virtual ~DtDegrees()
Definition: DtMath.h:29
void normalize(void)
normalize this vector in place
Definition: DtVector3.h:167
2 dimensional vector
Definition: DtMath.h:21
unsigned int uint32
Definition: DtCommonTypes.h:28
static T rpmToRadiansPerSec(T rpm)
rpm to radians per sec
Definition: DtMath.h:387
float32 myVal
Definition: DtMath.h:35
T x
Definition: DtVector2.h:105
#define DT_DLL_VRVMATH
Definition: vrvMath.h:18
static T Min(T lhs, T rhs)
Definition: DtMath.h:361
float32 val() const
Definition: DtMath.h:30
T y
Definition: DtVector4.h:118
static const float32 Gravity
Definition: DtMath.h:166
static const float32 m_fConvertToRadians
Definition: DtMath.h:167
static T Abs(T val)
Standard math routines.
Definition: DtMath.h:59
2 dimensional vector
Definition: DtMath.h:20
#define Assert(exp)
Definition: DtAssert.h:25