C# Class Sparrow.Utils.NumberUtil

Show file Open project: fmotagarcia/sparrow-sharp

Public Properties

Property Type Description
CosLUT float[]
PIHALF float
PIQUARTER float
SinLUT float[]

Public Methods

Method Description
Clamp ( float value, float min, float max ) : float
Equals ( float a, float b ) : bool

checks if two numbers are equal with a small margin of error

FastCos ( float angle ) : float

Fast cosinus calculation with a look up table. Note that it is less accurate than Math.Cos; the largest error is around 0.3 degrees;

FastSin ( float angle ) : float

Fast sinus calculation with a look up table. Note that it is less accurate than Math.Sin; the largest error is around 0.3 degrees

NextPowerOfTwo ( float number ) : int
NextPowerOfTwo ( int number ) : int

Private Methods

Method Description
NumberUtil ( ) : System

Method Details

Clamp() public static method

public static Clamp ( float value, float min, float max ) : float
value float
min float
max float
return float

Equals() public static method

checks if two numbers are equal with a small margin of error
public static Equals ( float a, float b ) : bool
a float
b float
return bool

FastCos() public static method

Fast cosinus calculation with a look up table. Note that it is less accurate than Math.Cos; the largest error is around 0.3 degrees;
public static FastCos ( float angle ) : float
angle float
return float

FastSin() public static method

Fast sinus calculation with a look up table. Note that it is less accurate than Math.Sin; the largest error is around 0.3 degrees
public static FastSin ( float angle ) : float
angle float
return float

NextPowerOfTwo() public static method

public static NextPowerOfTwo ( float number ) : int
number float
return int

NextPowerOfTwo() public static method

public static NextPowerOfTwo ( int number ) : int
number int
return int

Property Details

CosLUT public static property

Lookup table for fast cosine calculations
public static float[] CosLUT
return float[]

PIHALF public static property

public static float PIHALF
return float

PIQUARTER public static property

public static float PIQUARTER
return float

SinLUT public static property

Lookup table for fast sine calculations
public static float[] SinLUT
return float[]