Math utility class.

Static methods

staticinlinearrayAvgF(array:Array<FastFloat>):FastFloat

Calculate the average value of all elements of the given kha.FastFloat array.

staticinlinearrayAvgI(array:Array<Int>):FastFloat

Calculate the average value of all elements of the given integer array.

staticarraySumF(array:Array<FastFloat>):FastFloat

Calculate the sum of all elements of the given kha.FastFloat array.

staticarraySumI(array:Array<Int>):Int

Calculate the sum of all elements of the given integer array.

staticinlineclamp(value:FastFloat, minValue:FastFloat, maxValue:FastFloat):FastFloat

staticinlineclampI(value:Int, minValue:Int, maxValue:Int):Int

staticinlinehitbox(pointX:Int, pointY:Int, posX:FastFloat, posY:FastFloat, sizeX:FastFloat, sizeY:FastFloat):Bool

Check whether the given point is inside the given rectangle

staticinlinemapToRange(value:FastFloat, fromLeft:FastFloat, fromRight:FastFloat, toLeft:FastFloat, toRight:FastFloat):FastFloat

@:value({ precision : 0 })staticroundPrecision(value:FastFloat, precision:Int = 0):FastFloat

Round a value to the given precision.

Parameters:

value

The input value

precision

Number of decimal places