aboutsummaryrefslogtreecommitdiff
path: root/externals/g3dlite/G3D.lib/source/g3dmath.cpp
diff options
context:
space:
mode:
authorBrian <runningnak3d@gmail.com>2010-06-07 18:32:20 -0600
committerBrian <runningnak3d@gmail.com>2010-06-07 18:32:20 -0600
commit1fd70827128177aba3ac1334135fc12422819db0 (patch)
tree83355f4e124ef9d8e5ad47f9f904bfb001dcd3f9 /externals/g3dlite/G3D.lib/source/g3dmath.cpp
parent726a76e93aa3f20f4e642a01027f977f368a979e (diff)
* Reverted to the old G3D library, however collision still will not compile
* and is therefore commented out. --HG-- branch : trunk
Diffstat (limited to 'externals/g3dlite/G3D.lib/source/g3dmath.cpp')
-rw-r--r--externals/g3dlite/G3D.lib/source/g3dmath.cpp70
1 files changed, 0 insertions, 70 deletions
diff --git a/externals/g3dlite/G3D.lib/source/g3dmath.cpp b/externals/g3dlite/G3D.lib/source/g3dmath.cpp
deleted file mode 100644
index 95c9e16cc24..00000000000
--- a/externals/g3dlite/G3D.lib/source/g3dmath.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- @file g3dmath.cpp
-
- @author Morgan McGuire, graphics3d.com
-
- @created 2001-06-02
- @edited 2004-02-24
- */
-
-#include "G3D/g3dmath.h"
-#include <stdlib.h>
-
-namespace G3D {
-
-float gaussRandom(float mean, float stdev) {
-
- // Using Box-Mueller method from http://www.taygeta.com/random/gaussian.html
- // Modified to specify standard deviation and mean of distribution
- float w, x1, x2;
-
- // Loop until w is less than 1 so that log(w) is negative
- do {
- x1 = uniformRandom(-1.0, 1.0);
- x2 = uniformRandom(-1.0, 1.0);
-
- w = float(square(x1) + square(x2));
- } while (w > 1.0f);
-
- // Transform to gassian distribution
- // Multiply by sigma (stdev ^ 2) and add mean.
- return x2 * (float)square(stdev) * sqrtf((-2.0f * logf(w) ) / w) + mean;
-}
-
-
-int highestBit(uint32 x) {
- // Binary search.
- int base = 0;
-
- if (x & 0xffff0000) {
- base = 16;
- x >>= 16;
- }
- if (x & 0x0000ff00) {
- base += 8;
- x >>= 8;
- }
- if (x & 0x000000f0) {
- base += 4;
- x >>= 4;
- }
-
- static const int lut[] = {-1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3};
- return base + lut[x];
-}
-
-
-int iRandom(int low, int high) {
- int r = iFloor(low + (high - low + 1) * (double)rand() / RAND_MAX);
-
- // There is a *very small* chance of generating
- // a number larger than high.
- if (r > high) {
- return high;
- } else {
- return r;
- }
-}
-
-
-}