C# Class Fusion.Engine.Graphics.GIS.GlobeMath.DMathUtil

显示文件 Open project: demiurghg/FusionEngine

Public Methods

Method Description
Clamp ( double value, double min, double max ) : double

Clamps the specified value.

Clamp ( int value, int min, int max ) : int

Clamps the specified value.

DegreesToRadians ( DVector2 degree ) : DVector2
DegreesToRadians ( double degree ) : double

Converts degrees to radians.

DegreesToRevolutions ( double degree ) : double

Converts degrees to revolutions.

Gauss ( double amplitude, double x, double y, double radX, double radY, double sigmaX, double sigmaY ) : double

Gauss function.

GradiansToDegrees ( double gradian ) : double

Converts gradians to degrees.

GradiansToRadians ( double gradian ) : double

Converts gradians to radians.

GradiansToRevolutions ( double gradian ) : double

Converts gradians to revolutions.

IsOne ( double a ) : bool

Determines whether the specified value is close to one (1.0f).

IsZero ( double a ) : bool

Determines whether the specified value is close to zero (0.0f).

Lerp ( byte from, byte to, double amount ) : byte

Interpolates between two values using a linear function by a given amount.

See http://www.encyclopediaofmath.org/index.php/Linear_interpolation and http://fgiesen.wordpress.com/2012/08/15/linear-interpolation-past-present-and-future/

Lerp ( double from, double to, double amount ) : double

Interpolates between two values using a linear function by a given amount.

See http://www.encyclopediaofmath.org/index.php/Linear_interpolation and http://fgiesen.wordpress.com/2012/08/15/linear-interpolation-past-present-and-future/

Mod ( double value, double modulo ) : double

Calculates the modulo of the specified value.

Mod2PI ( double value ) : double

Calculates the modulo 2*PI of the specified value.

NearEqual ( double a, double b ) : bool

Checks if a and b are almost equals, taking into account the magnitude of doubleing point numbers (unlike WithinEpsilon method). See Remarks. See remarks.

The code is using the technique described by Bruce Dawson in Comparing doubleing point numbers 2012 edition.

RadiansToDegrees ( double radian ) : double

Converts radians to degrees.

RadiansToGradians ( double radian ) : double

Converts radians to gradians.

RadiansToRevolutions ( double radian ) : double

Converts radians to revolutions.

RevolutionsToDegrees ( double revolution ) : double

Converts revolutions to degrees.

RevolutionsToGradians ( double revolution ) : double

Converts revolutions to gradians.

RevolutionsToRadians ( double revolution ) : double

Converts revolutions to radians.

SmoothStep ( double amount ) : double

Performs smooth (cubic Hermite) interpolation between 0 and 1.

See https://en.wikipedia.org/wiki/Smoothstep

SmootherStep ( double amount ) : double

Performs a smooth(er) interpolation between 0 and 1 with 1st and 2nd order derivatives of zero at endpoints.

See https://en.wikipedia.org/wiki/Smoothstep

WithinEpsilon ( double a, double b, double epsilon ) : bool

Checks if a - b are almost equals within a double epsilon.

Wrap ( double value, double min, double max ) : double

Wraps the specified value into a range [min, max[

Wrap ( int value, int min, int max ) : int

Wraps the specified value into a range [min, max]

Method Details

Clamp() public static method

Clamps the specified value.
public static Clamp ( double value, double min, double max ) : double
value double The value.
min double The min.
max double The max.
return double

Clamp() public static method

Clamps the specified value.
public static Clamp ( int value, int min, int max ) : int
value int The value.
min int The min.
max int The max.
return int

DegreesToRadians() public static method

public static DegreesToRadians ( DVector2 degree ) : DVector2
degree DVector2
return DVector2

DegreesToRadians() public static method

Converts degrees to radians.
public static DegreesToRadians ( double degree ) : double
degree double The value to convert.
return double

DegreesToRevolutions() public static method

Converts degrees to revolutions.
public static DegreesToRevolutions ( double degree ) : double
degree double The value to convert.
return double

Gauss() public static method

Gauss function.
public static Gauss ( double amplitude, double x, double y, double radX, double radY, double sigmaX, double sigmaY ) : double
amplitude double Curve amplitude.
x double Position X.
y double Position Y
radX double Radius X.
radY double Radius Y.
sigmaX double Curve sigma X.
sigmaY double Curve sigma Y.
return double

GradiansToDegrees() public static method

Converts gradians to degrees.
public static GradiansToDegrees ( double gradian ) : double
gradian double The value to convert.
return double

GradiansToRadians() public static method

Converts gradians to radians.
public static GradiansToRadians ( double gradian ) : double
gradian double The value to convert.
return double

GradiansToRevolutions() public static method

Converts gradians to revolutions.
public static GradiansToRevolutions ( double gradian ) : double
gradian double The value to convert.
return double

IsOne() public static method

Determines whether the specified value is close to one (1.0f).
public static IsOne ( double a ) : bool
a double The doubleing value.
return bool

IsZero() public static method

Determines whether the specified value is close to zero (0.0f).
public static IsZero ( double a ) : bool
a double The doubleing value.
return bool

Lerp() public static method

Interpolates between two values using a linear function by a given amount.
See http://www.encyclopediaofmath.org/index.php/Linear_interpolation and http://fgiesen.wordpress.com/2012/08/15/linear-interpolation-past-present-and-future/
public static Lerp ( byte from, byte to, double amount ) : byte
from byte Value to interpolate from.
to byte Value to interpolate to.
amount double Interpolation amount.
return byte

Lerp() public static method

Interpolates between two values using a linear function by a given amount.
See http://www.encyclopediaofmath.org/index.php/Linear_interpolation and http://fgiesen.wordpress.com/2012/08/15/linear-interpolation-past-present-and-future/
public static Lerp ( double from, double to, double amount ) : double
from double Value to interpolate from.
to double Value to interpolate to.
amount double Interpolation amount.
return double

Mod() public static method

Calculates the modulo of the specified value.
public static Mod ( double value, double modulo ) : double
value double The value.
modulo double The modulo.
return double

Mod2PI() public static method

Calculates the modulo 2*PI of the specified value.
public static Mod2PI ( double value ) : double
value double The value.
return double

NearEqual() public static method

Checks if a and b are almost equals, taking into account the magnitude of doubleing point numbers (unlike WithinEpsilon method). See Remarks. See remarks.
The code is using the technique described by Bruce Dawson in Comparing doubleing point numbers 2012 edition.
public static NearEqual ( double a, double b ) : bool
a double The left value to compare.
b double The right value to compare.
return bool

RadiansToDegrees() public static method

Converts radians to degrees.
public static RadiansToDegrees ( double radian ) : double
radian double The value to convert.
return double

RadiansToGradians() public static method

Converts radians to gradians.
public static RadiansToGradians ( double radian ) : double
radian double The value to convert.
return double

RadiansToRevolutions() public static method

Converts radians to revolutions.
public static RadiansToRevolutions ( double radian ) : double
radian double The value to convert.
return double

RevolutionsToDegrees() public static method

Converts revolutions to degrees.
public static RevolutionsToDegrees ( double revolution ) : double
revolution double The value to convert.
return double

RevolutionsToGradians() public static method

Converts revolutions to gradians.
public static RevolutionsToGradians ( double revolution ) : double
revolution double The value to convert.
return double

RevolutionsToRadians() public static method

Converts revolutions to radians.
public static RevolutionsToRadians ( double revolution ) : double
revolution double The value to convert.
return double

SmoothStep() public static method

Performs smooth (cubic Hermite) interpolation between 0 and 1.
See https://en.wikipedia.org/wiki/Smoothstep
public static SmoothStep ( double amount ) : double
amount double Value between 0 and 1 indicating interpolation amount.
return double

SmootherStep() public static method

Performs a smooth(er) interpolation between 0 and 1 with 1st and 2nd order derivatives of zero at endpoints.
See https://en.wikipedia.org/wiki/Smoothstep
public static SmootherStep ( double amount ) : double
amount double Value between 0 and 1 indicating interpolation amount.
return double

WithinEpsilon() public static method

Checks if a - b are almost equals within a double epsilon.
public static WithinEpsilon ( double a, double b, double epsilon ) : bool
a double The left value to compare.
b double The right value to compare.
epsilon double Epsilon value
return bool

Wrap() public static method

Wraps the specified value into a range [min, max[
Is thrown when is greater than .
public static Wrap ( double value, double min, double max ) : double
value double The value.
min double The min.
max double The max.
return double

Wrap() public static method

Wraps the specified value into a range [min, max]
Is thrown when is greater than .
public static Wrap ( int value, int min, int max ) : int
value int The value to wrap.
min int The min.
max int The max.
return int