gnu.gleem.linalg
Class MathUtil

java.lang.Object
  |
  +--gnu.gleem.linalg.MathUtil

public class MathUtil
extends java.lang.Object

Utility math routines.


Constructor Summary
MathUtil()
           
 
Method Summary
static float clamp(float val, float min, float max)
          Clamps argument between min and max values.
static int clamp(int val, int min, int max)
          Clamps argument between min and max values.
static boolean makePerpendicular(Vec3f src, Vec3f dest)
          Makes an arbitrary vector perpendicular to src and inserts it into dest.
static int sgn(float f)
          Returns 1 if the sign of the given argument is positive; -1 if negative; 0 if 0.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MathUtil

public MathUtil()
Method Detail

makePerpendicular

public static boolean makePerpendicular(Vec3f src,
                                        Vec3f dest)
Makes an arbitrary vector perpendicular to src and inserts it into dest. Returns false if the source vector was equal to (0, 0, 0).


sgn

public static int sgn(float f)
Returns 1 if the sign of the given argument is positive; -1 if negative; 0 if 0.


clamp

public static float clamp(float val,
                          float min,
                          float max)
Clamps argument between min and max values.


clamp

public static int clamp(int val,
                        int min,
                        int max)
Clamps argument between min and max values.