Table of Contents

Class MathUtils

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

Contains Math related static methods.

public static class MathUtils
Inheritance
MathUtils

Fields

DegToRad

Gets PI divided by 180.

Methods

ApplyMinMax(double, double?, double?)

Applies minimum and maximum to the value if limitations are not null.

ApplyMinMax(int, int?, int?)

Applies minimum and maximum to the value if limitations are not null.

Clamp(int, int, int)

Returns int value clamped to the inclusive range of min and max.

ClampD(double, double, double)

Returns double value clamped to the inclusive range of min and max.

GetDistance(double, double, double, double)

Calculates distance between two points.

HighInt16(int)

Gets high short of the int value.

LessThanDefault(TypeCode, object?)

Compares value with the default value of the specified type.

LowInt16(int)

Gets low short of the int value.

MapRanges(double, double, double, double, double)

Maps value from range specified by (fromLow, fromHigh) to range specified by (toLow, toHigh).

Max(params double[])

Returns the larger of the specified numbers.

Max(params int[])

Returns the larger of the specified numbers.

Max(params int?[])

Returns the larger of the specified numbers.

Max(object?, object?)

Returns the larger of two objects. Objects must support IComparable interface.

Min(params double[])

Returns the smaller of the specified numbers.

Min(params int[])

Returns the smaller of the specified numbers.

Min(object?, object?)

Returns the smaller of two objects. Objects must support IComparable interface.

PercentOf(double, double)

Gets percentage of value.

SafeCompareTo(object, object)

Same as CompareTo(object) but additionally allows to compare different integer types without exceptions. Objects must support IComparable interface.

ValueInRange(object?, object?, object?)

Checks whether value is in range specified with minValue and maxValue parameters.