Package-level declarations

Types

Link copied to clipboard
open class Mat3

A 3x3 column major matrix.

Link copied to clipboard
open class Mat4

A 4x4 column major matrix.

Link copied to clipboard
class Mat4Stack(val stackSize: Int = DEFAULT_STACK_SIZE) : Mat4
Link copied to clipboard
open class MutableVec2f(x: Float, y: Float) : Vec2f
Link copied to clipboard
open class MutableVec2i(x: Int, y: Int) : Vec2i
Link copied to clipboard
open class MutableVec3f(x: Float, y: Float, z: Float) : Vec3f
Link copied to clipboard
open class MutableVec3i(x: Int, y: Int, z: Int) : Vec3i
Link copied to clipboard
open class MutableVec4f(x: Float, y: Float, z: Float, w: Float) : Vec4f
Link copied to clipboard
open class MutableVec4i(x: Int, y: Int, z: Int, w: Int) : Vec4i
Link copied to clipboard
class Ray
Link copied to clipboard
open class Rect(var x: Float = 0.0f, var y: Float = 0.0f, var width: Float = 0.0f, var height: Float = 0.0f)
Link copied to clipboard
Link copied to clipboard
open class Vec2f
Link copied to clipboard
open class Vec2i(x: Int, y: Int)
Link copied to clipboard
open class Vec3f : Vec2f
Link copied to clipboard
open class Vec3i(x: Int, y: Int, z: Int)
Link copied to clipboard
open class Vec4f : Vec3f
Link copied to clipboard
open class Vec4i(x: Int, y: Int, z: Int, w: Int)

Functions

Link copied to clipboard

Vector extensions

Link copied to clipboard
Link copied to clipboard
inline fun castRay(fromX: Int, fromY: Int, toX: Int, toY: Int, rayCanPass: (Int, Int) -> Boolean): Boolean

Cast a ray from a point to another point and checks if each point along the way can be passed via the rayCanPass parameter.

Link copied to clipboard
inline fun castThickRay(fromX: Int, fromY: Int, toX: Int, toY: Int, rayCanPass: (Int, Int) -> Boolean): Boolean
Link copied to clipboard
inline fun Double.clamp(min: Double = 0.0, max: Double = 1.0): Double
inline fun Float.clamp(min: Float = 0.0f, max: Float = 1.0f): Float
inline fun Int.clamp(min: Int, max: Int): Int
Link copied to clipboard
Link copied to clipboard
fun dist(ax: Double, ay: Double, bx: Double, by: Double): Double
fun dist(ax: Float, ay: Float, bx: Float, by: Float): Float
fun dist(ax: Int, ay: Int, bx: Int, by: Int): Double
Link copied to clipboard
fun Vec2f.distanceToEdge(edgeA: Vec2f, edgeB: Vec2f): Float
fun Vec3f.distanceToEdge(edgeA: Vec3f, edgeB: Vec3f): Float
Link copied to clipboard
fun Vec3f.distanceToLine(lineA: Vec3f, lineB: Vec3f): Float
Link copied to clipboard
fun Vec3f.distanceToRay(origin: Vec3f, direction: Vec3f): Float
Link copied to clipboard
Link copied to clipboard
fun distSqr(ax: Double, ay: Double, bx: Double, by: Double): Double
fun distSqr(ax: Float, ay: Float, bx: Float, by: Float): Float
fun distSqr(ax: Int, ay: Int, bx: Int, by: Int): Double
Link copied to clipboard
inline fun Float.floor(): Float
Link copied to clipboard
inline fun Float.floorToInt(): Int
Link copied to clipboard
fun getNumMipLevels(texWidth: Int, texHeight: Int): Int
Link copied to clipboard
infix fun Double.ife(b: Double): Boolean
infix fun Float.ife(b: Float): Boolean
Link copied to clipboard
@JvmName(name = "isFuzzyEqual_D")
inline fun Double.isFuzzyEqual(b: Double, eps: Double = FUZZY_EQ_D): Boolean
@JvmName(name = "isFuzzyEqual_F")
inline fun Float.isFuzzyEqual(b: Float, eps: Float = FUZZY_EQ_F): Boolean
inline fun isFuzzyEqual(a: Double, b: Double, eps: Double = FUZZY_EQ_D): Boolean
inline fun isFuzzyEqual(a: Float, b: Float, eps: Float = FUZZY_EQ_F): Boolean
Link copied to clipboard
inline fun Double.isFuzzyZero(eps: Double = FUZZY_EQ_D): Boolean
inline fun Float.isFuzzyZero(eps: Float = FUZZY_EQ_F): Boolean
Link copied to clipboard
fun map(inRangeStart: Float, inRangeEnd: Float, outRangeStart: Float, outRangeEnd: Float, value: Float): Float
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun Vec3f.nearestPointOnRay(origin: Vec3f, direction: Vec3f, result: MutableVec3f): MutableVec3f
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun <T> Array<T>.partition(k: Int, cmp: (T, T) -> Int)
fun <T> MutableList<T>.partition(k: Int, cmp: (T, T) -> Int)
fun <T> Array<T>.partition(rng: IntRange, k: Int, cmp: (T, T) -> Int)
fun <T> MutableList<T>.partition(rng: IntRange, k: Int, cmp: (T, T) -> Int)

fun <L, T> partition(elems: L, lt: Int, rt: Int, k: Int, get: L.(Int) -> T, cmp: (T, T) -> Int, swap: L.(Int, Int) -> Unit)

Partitions items with the given comparator. After partitioning, all elements left of k are smaller than all elements right of k with respect to the given comparator function.

Link copied to clipboard
fun scale(a: Vec2f, fac: Float): MutableVec2f
fun scale(a: Vec3f, fac: Float): MutableVec3f
Link copied to clipboard
fun smoothStep(low: Float, high: Float, x: Float): Float
Link copied to clipboard
fun sparseListOf(vararg ranges: IntRange): List<Int>
Link copied to clipboard
fun sqrDistancePointToEdge(x: Float, y: Float, edgeA: Vec2f, edgeB: Vec2f): Float
fun sqrDistancePointToEdge(x: Float, y: Float, z: Float, edgeA: Vec3f, edgeB: Vec3f): Float
Link copied to clipboard
fun sqrDistancePointToLine(x: Float, y: Float, z: Float, lineA: Vec3f, lineB: Vec3f): Float
Link copied to clipboard
fun sqrDistancePointToRay(x: Float, y: Float, z: Float, origin: Vec3f, direction: Vec3f): Float
Link copied to clipboard
fun Vec2f.sqrDistanceToEdge(edgeA: Vec2f, edgeB: Vec2f): Float
fun Vec3f.sqrDistanceToEdge(edgeA: Vec3f, edgeB: Vec3f): Float
Link copied to clipboard
fun Vec3f.sqrDistanceToLine(lineA: Vec3f, lineB: Vec3f): Float
Link copied to clipboard
fun Vec3f.sqrDistanceToRay(origin: Vec3f, direction: Vec3f): Float
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun Double.toDeg(): Double
inline fun Float.toDeg(): Float
Link copied to clipboard
inline fun Double.toRad(): Double
inline fun Float.toRad(): Float
Link copied to clipboard
fun triArea(va: Vec3f, vb: Vec3f, vc: Vec3f): Float
Link copied to clipboard
fun triAspectRatio(va: Vec3f, vb: Vec3f, vc: Vec3f): Float
Link copied to clipboard
fun Double.wrap(low: Double, high: Double): Double
fun Float.wrap(low: Float, high: Float): Float
fun Int.wrap(low: Int, high: Int): Int
Link copied to clipboard

Properties

Link copied to clipboard
const val DEG_2_RAD: Double
Link copied to clipboard
const val FLT_EPSILON: Float = 1.1920929E-7f

The difference between 1 and the smallest floating point number of type float that is greater than 1.

Link copied to clipboard
const val FUZZY_EQ_D: Double = 1.0E-10
Link copied to clipboard
const val FUZZY_EQ_F: Float = 1.0E-5f
Link copied to clipboard

Checks if this value is power of two

Link copied to clipboard
Link copied to clipboard
const val PI2: Double
Link copied to clipboard
const val PI2_F: Float
Link copied to clipboard
const val PI_F: Float
Link copied to clipboard

Returns the previous power of two of this

Link copied to clipboard
const val RAD_2_DEG: Double
Link copied to clipboard
const val SQRT_1_2: Float = 0.70710677f

Square-root of 0.5f