MathUtils

class MathUtils

A class that contains utility methods related to numbers.

Properties

Link copied to clipboard
val DEFAULT_EPSILON: Float = 1.0E-4f
Default epsilon value for fuzzy float comparisons.

Functions

Link copied to clipboard
open fun dist(x1: Float, y1: Float, x2: Float, y2: Float): Float
Returns the distance between two points.
Link copied to clipboard
open fun distanceToFurthestCorner(pointX: Float, pointY: Float, rectLeft: Float, rectTop: Float, rectRight: Float, rectBottom: Float): Float
Returns the furthest distance from the point defined by pointX and pointY to the four corners of the rectangle defined by rectLeft, rectTop, rectRight, and rectBottom.
Link copied to clipboard
open fun floorMod(x: Float, y: Int): Float
This returns as similar as floorMod.
open fun floorMod(x: Int, y: Int): Int
This is same as floorMod.
Link copied to clipboard
open fun geq(a: Float, b: Float, epsilon: Float): Boolean
Fuzzy greater than or equal to for floats.
Link copied to clipboard
open fun lerp(start: Float, stop: Float, amount: Float): Float
Returns the linear interpolation of amount between start and stop.