Class GSharkMath
A collection of default constants and methods used throughout the library.
Inheritance
Inherited Members
Syntax
public class GSharkMathFields
| Improve this Doc View SourceAngleTolerance
Represents the default angle tolerance, used when no other values are provided.
This is one degree, expressed in radians.
Declaration
public const double AngleTolerance = 0.0174532925199433Field Value
| Type | Description | 
|---|---|
| System.Double | 
Epsilon
The minimum value to determine whether two floating point numbers are the same.
Declaration
public const double Epsilon = 1E-10Field Value
| Type | Description | 
|---|---|
| System.Double | 
MaxTolerance
The default euclidean distance that identifies whether two points are coincident.
Declaration
public const double MaxTolerance = 0.001Field Value
| Type | Description | 
|---|---|
| System.Double | 
MinTolerance
The default euclidean distance that identifies whether two points are coincident.
Declaration
public const double MinTolerance = 1E-06Field Value
| Type | Description | 
|---|---|
| System.Double | 
UnsetValue
The value of an unset object.
Declaration
public const double UnsetValue = -1.23432101234321E+308Field Value
| Type | Description | 
|---|---|
| System.Double | 
Methods
| Improve this Doc View SourceGetBinomial(Int32, Int32)
Computes the binomial coefficient (denoted by n choose k).
Please see the following website for details: http://mathworld.wolfram.com/BinomialCoefficient.html
Declaration
public static double GetBinomial(int n, int k)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | n | Size of the set of distinct elements. | 
| System.Int32 | k | Size of the subsets. | 
Returns
| Type | Description | 
|---|---|
| System.Double | Combination of k and n | 
IsValidDouble(Double)
Returns true if the double value is valid.
Declaration
public static bool IsValidDouble(double x)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Double | x | Double value. | 
Returns
| Type | Description | 
|---|---|
| System.Boolean | True if it is valid. | 
RemapValue(Double, Interval, Interval)
Remaps a value into a new numerical target range given a source range.
Declaration
public static double RemapValue(double value, Interval source, Interval target)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Double | value | Value to remap. | 
| Interval | source | Source range. | 
| Interval | target | Target range. | 
Returns
| Type | Description | 
|---|---|
| System.Double | Remapped value. | 
ToDegrees(Double)
Converts radians to degrees.
Declaration
public static double ToDegrees(double radians)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Double | radians | Value radians. | 
Returns
| Type | Description | 
|---|---|
| System.Double | The degree value. | 
ToRadians(Double)
Converts degrees to radians.
Declaration
public static double ToRadians(double degrees)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Double | degrees | Value in degrees. | 
Returns
| Type | Description | 
|---|---|
| System.Double | The value in radians. | 
Truncate(Double, Byte)
Truncate decimal places without rounding.
https://stackoverflow.com/a/43639947
Declaration
public static decimal Truncate(double value, byte decimals = 6)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Double | value | Numerical value to truncate. | 
| System.Byte | decimals | Number of decimal to keep. | 
Returns
| Type | Description | 
|---|---|
| System.Decimal | The numerical value truncate. |