C# Class PixelFarm.VectorMath.MathHelper

Contains common mathematical functions and constants.
ファイルを表示 Open project: prepare/HTML-Renderer

Public Methods

Method Description
AlmostEqual ( double a, double b, double differenceAllowed ) : bool
BinomialCoefficient ( int n, int k ) : long

Calculates the binomial coefficient n above k.

DegreesToRadians ( double degrees ) : double

Convert degrees to radians

Factorial ( int n ) : long

Calculates the factorial of a given natural number.

GetDeltaAngle ( double StartAngle, double EndAngle ) : double
NextPowerOfTwo ( double n ) : double

Returns the next power of two that is larger than the specified number.

NextPowerOfTwo ( float n ) : float

Returns the next power of two that is larger than the specified number.

NextPowerOfTwo ( int n ) : int

Returns the next power of two that is larger than the specified number.

NextPowerOfTwo ( long n ) : long

Returns the next power of two that is larger than the specified number.

RadiansToDegrees ( double radians ) : double

Convert radians to degrees

Range0ToTau ( double Value ) : double
Swap ( double &a, double &b ) : void

Swaps two double values.

Swap ( float &a, float &b ) : void

Swaps two float values.

Method Details

AlmostEqual() public static method

public static AlmostEqual ( double a, double b, double differenceAllowed ) : bool
a double
b double
differenceAllowed double
return bool

BinomialCoefficient() public static method

Calculates the binomial coefficient n above k.
public static BinomialCoefficient ( int n, int k ) : long
n int The n.
k int The k.
return long

DegreesToRadians() public static method

Convert degrees to radians
public static DegreesToRadians ( double degrees ) : double
degrees double An angle in degrees
return double

Factorial() public static method

Calculates the factorial of a given natural number.
public static Factorial ( int n ) : long
n int The number.
return long

GetDeltaAngle() static public method

static public GetDeltaAngle ( double StartAngle, double EndAngle ) : double
StartAngle double
EndAngle double
return double

NextPowerOfTwo() public static method

Returns the next power of two that is larger than the specified number.
public static NextPowerOfTwo ( double n ) : double
n double The specified number.
return double

NextPowerOfTwo() public static method

Returns the next power of two that is larger than the specified number.
public static NextPowerOfTwo ( float n ) : float
n float The specified number.
return float

NextPowerOfTwo() public static method

Returns the next power of two that is larger than the specified number.
public static NextPowerOfTwo ( int n ) : int
n int The specified number.
return int

NextPowerOfTwo() public static method

Returns the next power of two that is larger than the specified number.
public static NextPowerOfTwo ( long n ) : long
n long The specified number.
return long

RadiansToDegrees() public static method

Convert radians to degrees
public static RadiansToDegrees ( double radians ) : double
radians double An angle in radians
return double

Range0ToTau() static public method

static public Range0ToTau ( double Value ) : double
Value double
return double

Swap() public static method

Swaps two double values.
public static Swap ( double &a, double &b ) : void
a double The first value.
b double The second value.
return void

Swap() public static method

Swaps two float values.
public static Swap ( float &a, float &b ) : void
a float The first value.
b float The second value.
return void