C# Class AcTools.Utils.MathUtils

Mostra file Open project: gro-ove/actools

Public Methods

Method Description
Abs ( this v ) : double
Abs ( this v ) : float
Acos ( this v ) : double
Acos ( this v ) : float
Clamp ( this v, double min, double max ) : double
Clamp ( this v, float min, float max ) : float
Clamp ( this v, int min, int max ) : int
ClampToByte ( this v ) : byte
Cos ( this v ) : double
Cos ( this v ) : float
Floor ( this value, double precision ) : double

For example: Round(0.342, 0.05) → 0.30.

Floor ( this value, int precision ) : int

For example: Round(340, 25) → 325.

IsFinite ( this v ) : bool
Max ( System.TimeSpan a, System.TimeSpan b ) : System.TimeSpan
Pow ( this v, double p ) : double
Pow ( this v, float p ) : float
Random ( ) : double
Random ( double maxValue ) : double
Random ( int maxValueExclusive ) : int
Random ( int minValueInclusive, int maxValueExclusive ) : int
RoughlyEquals ( this value, double origin ) : bool

Checks if double is equal to another double considering another double’s precision. For example: RoughlyEquals(15.342, 15.34) → true; RoughlyEquals(15.34, 15.342) → false.

Round ( this value, double precision ) : double

For example: Round(0.342, 0.05) → 0.35.

Round ( this value, int precision ) : int

For example: Round(340, 25) → 350.

RoundToInt ( this value ) : int
Saturate ( this value ) : double
Saturate ( this value ) : float
Sin ( this v ) : double
Sin ( this v ) : float
Sqrt ( this v ) : double
Sqrt ( this v ) : float
ToDoublePercentage ( this value ) : double
ToIntPercentage ( this value ) : int

Method Details

Abs() public static method

public static Abs ( this v ) : double
v this
return double

Abs() public static method

public static Abs ( this v ) : float
v this
return float

Acos() public static method

public static Acos ( this v ) : double
v this
return double

Acos() public static method

public static Acos ( this v ) : float
v this
return float

Clamp() public static method

public static Clamp ( this v, double min, double max ) : double
v this
min double
max double
return double

Clamp() public static method

public static Clamp ( this v, float min, float max ) : float
v this
min float
max float
return float

Clamp() public static method

public static Clamp ( this v, int min, int max ) : int
v this
min int
max int
return int

ClampToByte() public static method

public static ClampToByte ( this v ) : byte
v this
return byte

Cos() public static method

public static Cos ( this v ) : double
v this
return double

Cos() public static method

public static Cos ( this v ) : float
v this
return float

Floor() public static method

For example: Round(0.342, 0.05) → 0.30.
public static Floor ( this value, double precision ) : double
value this
precision double
return double

Floor() public static method

For example: Round(340, 25) → 325.
public static Floor ( this value, int precision ) : int
value this
precision int
return int

IsFinite() public static method

public static IsFinite ( this v ) : bool
v this
return bool

Max() public static method

public static Max ( System.TimeSpan a, System.TimeSpan b ) : System.TimeSpan
a System.TimeSpan
b System.TimeSpan
return System.TimeSpan

Pow() public static method

public static Pow ( this v, double p ) : double
v this
p double
return double

Pow() public static method

public static Pow ( this v, float p ) : float
v this
p float
return float

Random() public static method

public static Random ( ) : double
return double

Random() public static method

public static Random ( double maxValue ) : double
maxValue double
return double

Random() public static method

public static Random ( int maxValueExclusive ) : int
maxValueExclusive int
return int

Random() public static method

public static Random ( int minValueInclusive, int maxValueExclusive ) : int
minValueInclusive int
maxValueExclusive int
return int

RoughlyEquals() public static method

Checks if double is equal to another double considering another double’s precision. For example: RoughlyEquals(15.342, 15.34) → true; RoughlyEquals(15.34, 15.342) → false.
public static RoughlyEquals ( this value, double origin ) : bool
value this Value which will be compared
origin double Another value which will be compared and will define precision
return bool

Round() public static method

For example: Round(0.342, 0.05) → 0.35.
public static Round ( this value, double precision ) : double
value this
precision double
return double

Round() public static method

For example: Round(340, 25) → 350.
public static Round ( this value, int precision ) : int
value this
precision int
return int

RoundToInt() public static method

public static RoundToInt ( this value ) : int
value this
return int

Saturate() public static method

public static Saturate ( this value ) : double
value this
return double

Saturate() public static method

public static Saturate ( this value ) : float
value this
return float

Sin() public static method

public static Sin ( this v ) : double
v this
return double

Sin() public static method

public static Sin ( this v ) : float
v this
return float

Sqrt() public static method

public static Sqrt ( this v ) : double
v this
return double

Sqrt() public static method

public static Sqrt ( this v ) : float
v this
return float

ToDoublePercentage() public static method

public static ToDoublePercentage ( this value ) : double
value this
return double

ToIntPercentage() public static method

public static ToIntPercentage ( this value ) : int
value this
return int