Generated by DocFX

Class GSharkMath

A collection of default constants and methods used throughout the library.

Inheritance
System.Object
GSharkMath
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Syntax
public class GSharkMath

Fields

| Improve this Doc View Source

AngleTolerance

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.0174532925199433
Field Value
Type Description
System.Double
| Improve this Doc View Source

Epsilon

The minimum value to determine whether two floating point numbers are the same.

Declaration
public const double Epsilon = 1E-10
Field Value
Type Description
System.Double
| Improve this Doc View Source

MaxTolerance

The default euclidean distance that identifies whether two points are coincident.

Declaration
public const double MaxTolerance = 0.001
Field Value
Type Description
System.Double
| Improve this Doc View Source

MinTolerance

The default euclidean distance that identifies whether two points are coincident.

Declaration
public const double MinTolerance = 1E-06
Field Value
Type Description
System.Double
| Improve this Doc View Source

UnsetValue

The value of an unset object.

Declaration
public const double UnsetValue = -1.23432101234321E+308
Field Value
Type Description
System.Double

Methods

| Improve this Doc View Source

GetBinomial(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

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.