Package-level declarations

Types

Link copied to clipboard
@Serializable
data class BooleanVector2(val x: Boolean, val y: Boolean)

Boolean 2D vector

Link copied to clipboard
@Serializable
data class BooleanVector3(val x: Boolean, val y: Boolean, val z: Boolean)

Boolean 3D vector

Link copied to clipboard
@Serializable
data class BooleanVector4(val x: Boolean, val y: Boolean, val z: Boolean, val w: Boolean)

Boolean 4D vector

Link copied to clipboard

An interface representing a type that can be converted into a Vector4. This allows classes implementing this interface to define a custom transformation or mapping to a Vector4 instance, enabling compatibility with systems and operations that utilize 4-dimensional vectors.

Link copied to clipboard
Link copied to clipboard
object Hashes

From ztellman's Artifex library

Link copied to clipboard
@Serializable
data class IntVector2(val x: Int, val y: Int)

Integer 2D vector, exclusively for integer calculations.

Link copied to clipboard
@Serializable
data class IntVector3(val x: Int, val y: Int, val z: Int)

Integer 3D vector, exclusively for integer calculations.

Link copied to clipboard
@Serializable
data class IntVector4(val x: Int, val y: Int, val z: Int, val w: Int)

Integer 4D vector, exclusively for integer calculations.

Link copied to clipboard
interface LinearType<T : LinearType<T>>

Represents a linear type that supports basic arithmetic operations for objects of the same type. This interface enforces a linear structure that can be used to define custom mathematical types.

Link copied to clipboard
@Serializable
data class Matrix33(    val c0r0: Double = 0.0,     val c1r0: Double = 0.0,     val c2r0: Double = 0.0,     val c0r1: Double = 0.0,     val c1r1: Double = 0.0,     val c2r1: Double = 0.0,     val c0r2: Double = 0.0,     val c1r2: Double = 0.0,     val c2r2: Double = 0.0) : LinearType<Matrix33>

A 3x3 matrix with double precision

Link copied to clipboard
@Serializable
data class Matrix44(    val c0r0: Double = 0.0,     val c1r0: Double = 0.0,     val c2r0: Double = 0.0,     val c3r0: Double = 0.0,     val c0r1: Double = 0.0,     val c1r1: Double = 0.0,     val c2r1: Double = 0.0,     val c3r1: Double = 0.0,     val c0r2: Double = 0.0,     val c1r2: Double = 0.0,     val c2r2: Double = 0.0,     val c3r2: Double = 0.0,     val c0r3: Double = 0.0,     val c1r3: Double = 0.0,     val c2r3: Double = 0.0,     val c3r3: Double = 0.0) : LinearType<Matrix44>

A 4x4 matrix with double precision

Link copied to clipboard
@Serializable
data class Matrix55(    val c0r0: Double = 0.0,     val c1r0: Double = 0.0,     val c2r0: Double = 0.0,     val c3r0: Double = 0.0,     val c4r0: Double = 0.0,     val c0r1: Double = 0.0,     val c1r1: Double = 0.0,     val c2r1: Double = 0.0,     val c3r1: Double = 0.0,     val c4r1: Double = 0.0,     val c0r2: Double = 0.0,     val c1r2: Double = 0.0,     val c2r2: Double = 0.0,     val c3r2: Double = 0.0,     val c4r2: Double = 0.0,     val c0r3: Double = 0.0,     val c1r3: Double = 0.0,     val c2r3: Double = 0.0,     val c3r3: Double = 0.0,     val c4r3: Double = 0.0,     val c0r4: Double = 0.0,     val c1r4: Double = 0.0,     val c2r4: Double = 0.0,     val c3r4: Double = 0.0,     val c4r4: Double = 0.0)

A 5x5 matrix with double precision

Link copied to clipboard
interface Parametric1D<R>

Represents a 1-dimensional parametric function that computes a value of type R based on a parameter t of type Double. This interface can be implemented to define various parametric mathematical or functional relationships.

Link copied to clipboard
interface Parametric2D<R>

Parametric2D defines a two-dimensional parametric function.

Link copied to clipboard
interface Parametric3D<R>

Represents a three-dimensional parametric function.

Link copied to clipboard
interface Parametric4D<R>

Represents a parametrized function defined in a 4D space. Provides the means to compute a value of type R given four input parameters: u, v, w, and t, typically representing dimensions or coordinates in the 4D space.

Link copied to clipboard
@Serializable
data class Polar(val theta: Double, val radius: Double = 1.0) : LinearType<Polar>

A 2D point defined in the Polar coordinate system.

Link copied to clipboard
@Serializable
data class Quaternion(val x: Double, val y: Double, val z: Double, val w: Double)

Quaternion class for representing orientations in 3D space

Link copied to clipboard
@Serializable
data class Spherical(val theta: Double, val phi: Double, val radius: Double) : LinearType<Spherical>

Spherical coordinate. The poles (phi) are at the positive and negative y-axis. The equator starts at positive z.

Link copied to clipboard
Link copied to clipboard
@Serializable
data class Vector2(val x: Double, val y: Double) : LinearType<Vector2> , EuclideanVector<Vector2>

A 2D vector representation in Cartesian coordinates with methods for mathematical operations and conversions. Implements linear algebra functionalities and provides utility methods for creating and manipulating 2D vectors.

Link copied to clipboard
@Serializable
data class Vector3(val x: Double, val y: Double, val z: Double) : LinearType<Vector3> , EuclideanVector<Vector3>

Double-precision 3D vector.

Link copied to clipboard
@Serializable
data class Vector4(val x: Double, val y: Double, val z: Double, val w: Double) : LinearType<Vector4> , EuclideanVector<Vector4>

Double-precision 4D vector.

Link copied to clipboard

YPolarity defines the orientation of the Y-axis in a coordinate system.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Computes the average of all Vector2 instances in the iterable.


Calculates the component-wise average of all Vector4 elements in the iterable.

Link copied to clipboard
fun <T : LinearType<T>> bezier(x0: T, c0: T, x1: T, t: Double): T
fun bezier(x0: Double, c0: Double, x1: Double, t: Double): Double
fun <T : LinearType<T>> bezier(x0: T, c0: T, c1: T, x1: T, t: Double): T

fun bezier(x0: Vector2, c0: Vector2, x1: Vector2, t: Double): Vector2

Evaluate a 2D quadratic bezier defined by (x0, c0, x1) for t

fun bezier(x0: Vector3, c0: Vector3, x1: Vector3, t: Double): Vector3

Evaluate a 3D quadratic bezier defined by (x0, c0, x1) for t

fun bezier(x0: Double, c0: Double, c1: Double, x1: Double, t: Double): Double

Evaluate a cubic bezier defined by (x0, c0, c1, x1) for t

fun bezier(x0: Vector2, c0: Vector2, c1: Vector2, x1: Vector2, t: Double): Vector2

Evaluate a 2D cubic bezier defined by (x0, c0, c1, x1) for t

fun bezier(x0: Vector3, c0: Vector3, c1: Vector3, x1: Vector3, t: Double): Vector3

Samples a single point based on the provided t value from given 3D cubic Bézier curve.

Link copied to clipboard
fun clamp(value: Double, min: Double, max: Double): Double
fun clamp(value: Int, min: Int, max: Int): Int

Returns number whose value is limited between min and max.

Link copied to clipboard
@JvmName(name = "doubleClamp")
fun Double.clamp(min: Double, max: Double): Double
@JvmName(name = "intClamp")
fun Int.clamp(min: Int, max: Int): Int

Returns IntVector2 whose value is limited between min and max per vector component.

Returns IntVector3 whose value is limited between min and max per vector component.

Returns IntVector4 whose value is limited between min and max per vector component.

Returns Vector2 whose value is limited between min and max per vector component.

Returns Vector3 whose value is limited between min and max per vector component.

Returns Vector4 whose value is limited between min and max per vector component.

Link copied to clipboard
fun derivative(x0: Double, c0: Double, x1: Double, t: Double): Double
fun derivative(p0: Double, p1: Double, p2: Double, p3: Double, t: Double): Double
fun derivative(p0: Vector2, p1: Vector2, p2: Vector2, p3: Vector2, t: Double): Vector2
fun derivative(p0: Vector3, p1: Vector3, p2: Vector3, p3: Vector3, t: Double): Vector3
Link copied to clipboard
fun derivative2(p0: Double, p1: Double, p2: Double, p3: Double, t: Double): Double
fun derivative2(p0: Vector2, p1: Vector2, p2: Vector2, p3: Vector2, t: Double): Vector2
fun derivative2(p0: Vector3, p1: Vector3, p2: Vector3, p3: Vector3, t: Double): Vector3
Link copied to clipboard
Link copied to clipboard
fun linearstep(edge0: Double, edge1: Double, x: Double): Double
Link copied to clipboard
fun map(before: ClosedFloatingPointRange<Double>, after: ClosedFloatingPointRange<Double>, value: Double, clamp: Boolean = false): Double
fun map(beforeLeft: Double, beforeRight: Double, afterLeft: Double, afterRight: Double, value: Double, clamp: Boolean = false): Double

Linearly maps a value, which is given in the before domain to a value in the after domain.

Link copied to clipboard

Linearly maps a value, which is given in the before domain to a value in the after domain.

@JvmName(name = "doubleMap")
fun Double.map(beforeLeft: Double, beforeRight: Double, afterLeft: Double, afterRight: Double, clamp: Boolean = false): Double

Linearly maps a value, which is given in the before domain to a value in the after domain

fun Vector2.map(beforeLeft: Vector2, beforeRight: Vector2, afterLeft: Vector2, afterRight: Vector2, clamp: Boolean = false): Vector2
fun Vector3.map(beforeLeft: Vector3, beforeRight: Vector3, afterLeft: Vector3, afterRight: Vector3, clamp: Boolean = false): Vector3
fun Vector4.map(beforeLeft: Vector4, beforeRight: Vector4, afterLeft: Vector4, afterRight: Vector4, clamp: Boolean = false): Vector4
Link copied to clipboard
fun max(a: Vector2, b: Vector2): Vector2

Determines the component-wise maximum of two 2D vectors.

fun max(a: Vector3, b: Vector3): Vector3
fun max(a: Vector4, b: Vector4): Vector4
Link copied to clipboard
fun min(a: Vector2, b: Vector2): Vector2

Computes the component-wise minimum of two 2D vectors.

fun min(a: Vector3, b: Vector3): Vector3
fun min(a: Vector4, b: Vector4): Vector4
Link copied to clipboard
fun mix(left: Double, right: Double, x: Double): Double
fun mix(a: Vector2, b: Vector2, mix: Double): Vector2
fun mix(a: Vector3, b: Vector3, mix: Double): Vector3
fun mix(a: Vector4, b: Vector4, mix: Double): Vector4
Link copied to clipboard
fun mixAngle(leftAngle: Double, rightAngle: Double, x: Double): Double

Similar to mix() but assuming that 355° and 5° are 10° apart, not 350°.

Link copied to clipboard
fun normal(x0: Vector2, c0: Vector2, x1: Vector2, t: Double): Vector2
Link copied to clipboard

Computes a normalization factor based on the input values a, b, and c. The factor is calculated as a power of 2, inversely proportional to the largest exponent of the input values, if it falls outside the range of -8, 8. Otherwise, the factor defaults to 1.0.

Computes a normalization factor based on the maximum exponent of the input values.

Link copied to clipboard
Link copied to clipboard

Similar to derivative but handles cases in which p0 and p1 coincide.

Similar to derivative but handles cases in which p0 and p1 or p2 and p3 coincide.

Link copied to clipboard
Link copied to clipboard
@JvmName(name = "doubleSaturate")
fun Double.saturate(): Double
Link copied to clipboard
Link copied to clipboard
fun smootherstep(edge0: Double, edge1: Double, x: Double): Double

Smootherstep

Link copied to clipboard
fun smoothstep(edge0: Double, edge1: Double, x: Double): Double

Smoothstep

Link copied to clipboard
@JvmName(name = "doubleSmoothstep")
fun Double.smoothstep(edge0: Double, edge1: Double): Double
Link copied to clipboard
fun smoothstepIn(edge0: Double, edge1: Double, x: Double): Double

Smoothstep

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Computes the sum of all vectors in the iterable.


Calculates the summation of all vectors in the iterable.

Link copied to clipboard
operator fun Double.times(m: Matrix33): Matrix33
operator fun Double.times(m: Matrix44): Matrix44
operator fun Double.times(v: Vector2): Vector2
operator fun Double.times(v: Vector3): Vector3
operator fun Double.times(v: Vector4): Vector4
operator fun Int.times(v: IntVector2): IntVector2
operator fun Int.times(v: IntVector3): IntVector3
operator fun Int.times(v: IntVector4): IntVector4