Hexagon
Loading...
Searching...
No Matches
Hexath Class Reference

Class for static math operations. More...

Static Public Member Functions

static float SnapNumberToStep (this float number, float step)
 Snaps the given number to the nearest float number within the given step. Rounding for float-point numbers with adjustable accuracy given as the 'step' argument.
 
static Vector2 GetCirclePointDegrees (float radius, float angle)
 Returns a point on the circumference with the given 'radius' at the given 'angle' in degrees, starting at the point (radius, 0) as in math.
 
static Vector2 GetCirclePointRadians (float radius, float angle)
 Returns a point on the circumference with the given 'radius' at the given 'angle' in radians, starting at the point (radius, 0) as in math.
 
static int LeastCommonMultiple (int a, int b)
 Least common multiple of two positive numbers. An exception will be thrown if any of the input numbers are less or equal to zero.
 
static int LeastCommonMultiple (int[] values)
 Least common multiple of an array of numbers. An exception will be thrown if any of the input numbers are less or equal to zero. Input array may contain any number of elements but it cannot be null.
 
static int GreatestCommonFactor (int a, int b)
 Greatest common divisor (aka highest common factor) of two numbers. An exception will be thrown if any of the input numbers are less or equal to zero.
 
static int GreatestCommonFactor (int[] values)
 Greatest common divisor (aka highest common factor) of an array of numbers. An exception will be thrown if any of the input numbers are less or equal to zero. Input array may contain any number of elements but it cannot be null.
 
static int Ternarsign (float value)
 Returns -1 if 'value' is negative, 0 if 'value' is 0, 1 if 'value' is positive.
 
static float Ramp (float value, float slideThreshold, float holdValue)
 Holds the input 'value' at 'holdValue' when it is larger than 'slideThreshold', otherwise starts decreasing starting from 'holdValue'.
 
static float ClampMin (this float value, float min)
 Deprecated. Use Mathf.Max instead. Returns a value in range of [min, +INF). If input value is smaller or equal to 'min' the output will be 'min', otherwise 'value'.
 
static float ClampMin (this int value, int min)
 Deprecated. Use Mathf.Max instead. Returns a value in range of [min, +INF). If input value is smaller or equal to 'min' the output will be 'min', otherwise 'value'.
 
static float ClampMax (this float value, float max)
 Deprecated. Use Mathf.Min instead. Returns a value in range of (-INF; max]. If input value is larger or equal to 'max' the output will be 'max', otherwise 'value'.
 
static float ClampMax (this int value, int max)
 Deprecated. Use Mathf.Min instead. Returns a value in range of (-INF; max]. If input value is larger or equal to 'max' the output will be 'max', otherwise 'value'.
 
static bool NearlyEqualsPositive (this float a, float b, double epsilon=1E-5)
 Returns true if (a - b) no larger than epsilon, does not check signs of numbers!
 
static bool NearlyEquals (this float a, float b, double epsilon=1E-5)
 Returns true if |a - b| no larger than epsilon, works on any numbers.
 
static float Remap (this float value, float minFrom, float maxFrom, float minTo, float maxTo)
 Remaps value from one range to another. It returns a point that lies on the same relative position on the output range as on the input range.
 

Static Public Attributes

const float SQRT_2 = 1.4142136F
 
const float HALF_SQRT_2 = SQRT_2 / 2.0F
 
const float SQRT_3 = 1.7320508F
 
const float TWO_PI = Mathf.PI * 2.0f
 
const float HALF_PI = Mathf.PI / 2.0F
 
const float QUARTER_PI = Mathf.PI / 4.0F
 

Detailed Description

Class for static math operations.

Member Function Documentation

◆ ClampMax() [1/2]

static float Hexath.ClampMax ( this float value,
float max )
inlinestatic

Deprecated. Use Mathf.Min instead. Returns a value in range of (-INF; max]. If input value is larger or equal to 'max' the output will be 'max', otherwise 'value'.

◆ ClampMax() [2/2]

static float Hexath.ClampMax ( this int value,
int max )
inlinestatic

Deprecated. Use Mathf.Min instead. Returns a value in range of (-INF; max]. If input value is larger or equal to 'max' the output will be 'max', otherwise 'value'.

◆ ClampMin() [1/2]

static float Hexath.ClampMin ( this float value,
float min )
inlinestatic

Deprecated. Use Mathf.Max instead. Returns a value in range of [min, +INF). If input value is smaller or equal to 'min' the output will be 'min', otherwise 'value'.

◆ ClampMin() [2/2]

static float Hexath.ClampMin ( this int value,
int min )
inlinestatic

Deprecated. Use Mathf.Max instead. Returns a value in range of [min, +INF). If input value is smaller or equal to 'min' the output will be 'min', otherwise 'value'.

◆ GetCirclePointDegrees()

static Vector2 Hexath.GetCirclePointDegrees ( float radius,
float angle )
inlinestatic

Returns a point on the circumference with the given 'radius' at the given 'angle' in degrees, starting at the point (radius, 0) as in math.

◆ GetCirclePointRadians()

static Vector2 Hexath.GetCirclePointRadians ( float radius,
float angle )
inlinestatic

Returns a point on the circumference with the given 'radius' at the given 'angle' in radians, starting at the point (radius, 0) as in math.

◆ GreatestCommonFactor() [1/2]

static int Hexath.GreatestCommonFactor ( int a,
int b )
inlinestatic

Greatest common divisor (aka highest common factor) of two numbers. An exception will be thrown if any of the input numbers are less or equal to zero.

◆ GreatestCommonFactor() [2/2]

static int Hexath.GreatestCommonFactor ( int[] values)
inlinestatic

Greatest common divisor (aka highest common factor) of an array of numbers. An exception will be thrown if any of the input numbers are less or equal to zero. Input array may contain any number of elements but it cannot be null.

◆ LeastCommonMultiple() [1/2]

static int Hexath.LeastCommonMultiple ( int a,
int b )
inlinestatic

Least common multiple of two positive numbers. An exception will be thrown if any of the input numbers are less or equal to zero.

◆ LeastCommonMultiple() [2/2]

static int Hexath.LeastCommonMultiple ( int[] values)
inlinestatic

Least common multiple of an array of numbers. An exception will be thrown if any of the input numbers are less or equal to zero. Input array may contain any number of elements but it cannot be null.

◆ NearlyEquals()

static bool Hexath.NearlyEquals ( this float a,
float b,
double epsilon = 1E-5 )
inlinestatic

Returns true if |a - b| no larger than epsilon, works on any numbers.

◆ NearlyEqualsPositive()

static bool Hexath.NearlyEqualsPositive ( this float a,
float b,
double epsilon = 1E-5 )
inlinestatic

Returns true if (a - b) no larger than epsilon, does not check signs of numbers!

◆ Ramp()

static float Hexath.Ramp ( float value,
float slideThreshold,
float holdValue )
inlinestatic

Holds the input 'value' at 'holdValue' when it is larger than 'slideThreshold', otherwise starts decreasing starting from 'holdValue'.

◆ Remap()

static float Hexath.Remap ( this float value,
float minFrom,
float maxFrom,
float minTo,
float maxTo )
inlinestatic

Remaps value from one range to another. It returns a point that lies on the same relative position on the output range as on the input range.

Parameters
valueValue to remap
minFromMinimum value of the input range
maxFromMaximum value of the input range
minToMinimum value of the output range
maxToMaximum value of the output range
Returns

◆ SnapNumberToStep()

static float Hexath.SnapNumberToStep ( this float number,
float step )
inlinestatic

Snaps the given number to the nearest float number within the given step. Rounding for float-point numbers with adjustable accuracy given as the 'step' argument.

Parameters
numberNumber to be rounded
stepAccuracy of rounding, modulo of the maximum difference with the original 'number'

◆ Ternarsign()

static int Hexath.Ternarsign ( float value)
inlinestatic

Returns -1 if 'value' is negative, 0 if 'value' is 0, 1 if 'value' is positive.

Member Data Documentation

◆ HALF_PI

const float Hexath.HALF_PI = Mathf.PI / 2.0F
static

◆ HALF_SQRT_2

const float Hexath.HALF_SQRT_2 = SQRT_2 / 2.0F
static

◆ QUARTER_PI

const float Hexath.QUARTER_PI = Mathf.PI / 4.0F
static

◆ SQRT_2

const float Hexath.SQRT_2 = 1.4142136F
static

◆ SQRT_3

const float Hexath.SQRT_3 = 1.7320508F
static

◆ TWO_PI

const float Hexath.TWO_PI = Mathf.PI * 2.0f
static

The documentation for this class was generated from the following file: