Subversion Repositories AndroidProjects

Rev

Rev 70 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.gebauz.framework.util;

public class MathUtil
{
       
        static public final float EPSILON = 0.0000001f;

       
        public static float clamp(float value, float min, float max)
        {
                if (value < min)
                        return min;
                if (value > max)
                        return max;
                return value;
        }
       
        public static int clamp(int value, int min, int max)
        {
                if (value < min)
                        return min;
                if (value > max)
                        return max;
                return value;
        }
       
        public static float degToRad(float degrees)
        {
                return (float)(degrees * Math.PI / 180.0f);
        }
       
        public static float radToDeg(float rad)
        {
                return (float)(rad * 180.0f / Math.PI);
        }
       
}