parin.joka.math

The math module provides mathematical data structures and functions.

Types 33

aliasVec2 = GVec2!float

A 2D vector using floats.

aliasVec3 = GVec3!float

A 3D vector using floats.

aliasVec4 = GVec4!float

A 4D vector using floats.

aliasIVec2 = GVec2!int

A 2D vector using ints.

aliasIVec3 = GVec3!int

A 3D vector using ints.

aliasIVec4 = GVec4!int

A 4D vector using ints.

aliasDVec2 = GVec2!double

A 2D vector using doubles.

aliasDVec3 = GVec3!double

A 3D vector using doubles.

aliasDVec4 = GVec4!double

A 4D vector using doubles.

aliasRect = GRect!float

A 2D rectangle using floats.

aliasCirc = GCirc!float

A 2D circle using floats.

aliasLine = GLine!float

A 2D line using floats.

aliasIRect = GRect!int

A 2D rectangle using ints.

aliasSRect = GRect!(int, short)

A 2D rectangle using ints for the position and shorts for the size.

aliasTween = GTween!float

A tween using floats.

A tween using 2D vectors.

aliasRoundingFunc = float function(float x)

A function used for rounding.

aliasRounding64Func = double function(double x)

A function used for rounding.

aliasEasingFunc = float function(float x)

A function used for easing.

enumRounding : ubyte

A type representing rounding functions.

noneNo rounding.
floorRound down.
roundRound to nearest.
ceilRound up.
enumEasing : ubyte

A type representing easing functions.

linearConstant speed.
inSineSlow start.
outSineSlow end.
inOutSineSlow start and end.
inCubicCubic in.
outCubicCubic out.
inOutCubicCubic in-out.
inQuintQuintic in.
outQuintQuintic out.
inOutQuintQuintic in-out.
inCircCircular in.
outCircCircular out.
inOutCircCircular in-out.
inElasticElastic in.
outElasticElastic out.
inOutElasticElastic in-out.
inQuadQuadratic in.
outQuadQuadratic out.
inOutQuadQuadratic in-out.
inQuartQuartic in.
outQuartQuartic out.
inOutQuartQuartic in-out.
inExpoExponential in.
outExpoExponential out.
inOutExpoExponential in-out.
inBackBack in.
outBackBack out.
inOutBackBack in-out.
inBounceBounce in.
outBounceBounce out.
inOutBounceBounce in-out.
enumTweenMode : ubyte

A type that describes how a tween should update.

bombIt stops updating when it reaches the beginning or end of the animation.
loopIt returns to the beginning or end of the animation when it reaches the beginning or end of the animation.
yoyoIt reverses the given delta time when it reaches the beginning or end of the animation.
enumHook : ubyte

A type representing relative points.

topLeftThe top left point.
topThe top point.
topRightThe top right point.
leftThe left point.
centerThe center point.
rightThe right point.
bottomLeftThe bottom left point.
bottomThe bottom point.
bottomRightThe bottom right point.
structMargin

A set of 4 integer margins.

Fields
int left
int top
int right
int bottom
Constructors
this(int left, int top, int right, int bottom)
this(int left)
structRgba

A RGBA color using ubytes.

Fields
ubyte r
ubyte g
ubyte b
ubyte a
formThe form of the color.
zeroThe zero value of the color.
oneThe one value of the color.
lengthThe length of the color.
Methods
IStr toStr() @trusted @safe nothrow @nogc
ubyte[] items() @safe nothrow @nogc @trusted
bool isZero() @safe nothrow @nogc
bool isOne() @safe nothrow @nogc
Rgba rrrr() @safe nothrow @nogc
Rgba gggg() @safe nothrow @nogc
Rgba bbbb() @safe nothrow @nogc
Rgba aaaa() @safe nothrow @nogc
Rgba alpha(ubyte value) @safe nothrow @nogcReturns a color with just the alpha modified.
ubyte min() @trusted @safe nothrow @nogc
ubyte max() @trusted @safe nothrow @nogc
Constructors
this(ubyte r, ubyte g, ubyte b, ubyte a = 255)
this(ubyte r)
structGVec2(T)

A generic 2D vector.

Fields
T x
T y
formThe form of the vector.
zeroThe zero value of the vector.
oneThe one value of the vector.
lengthThe length of the vector.
Methods
IStr toStr() @trusted @safe nothrow @nogc
T[] items() @safe nothrow @nogc @trusted
bool isZero() @safe nothrow @nogc
bool isOne() @safe nothrow @nogc
T chop() @safe nothrow @nogc
This abs() @safe nothrow @nogc
GVec2!T yx() @safe nothrow @nogc
GVec2!T xx() @safe nothrow @nogc
GVec2!T yy() @safe nothrow @nogc
Float magnitudeSquared() @safe nothrow @nogc
Float magnitude() @safe nothrow @nogc
Float distanceTo(This to) @safe nothrow @nogc
This opBinary(IStr op)(This rhs) @safe nothrow @nogc
This opBinary(IStr op)(T rhs) @safe nothrow @nogc
This opBinaryRight(IStr op)(T lhs) @safe nothrow @nogc
This opUnary(IStr op : "-")() @safe nothrow @nogc
void opOpAssign(IStr op)(This rhs) @safe nothrow @nogc
void opOpAssign(IStr op)(T rhs) @safe nothrow @nogc
T min() @trusted @safe nothrow @nogc
T max() @trusted @safe nothrow @nogc
This _swizzleN(G)(const(G)[] args...) @trusted @safe nothrow @nogc
This _swizzleC(IStr args...) @trusted @safe nothrow @nogc
This swizzle(G)(const(G)[] args...) @trusted @safe nothrow @nogc
Constructors
this(T x, T y)
this(T x)
structGVec3(T)

A generic 3D vector.

Fields
T x
T y
T z
formThe form of the vector.
zeroThe zero value of the vector.
oneThe one value of the vector.
lengthThe length of the vector.
Methods
IStr toStr() @trusted @safe nothrow @nogc
T[] items() @safe nothrow @nogc @trusted
bool isZero() @safe nothrow @nogc
bool isOne() @safe nothrow @nogc
GVec2!T chop() @safe nothrow @nogc
This abs() @safe nothrow @nogc
GVec2!T yx() @safe nothrow @nogc
GVec2!T xx() @safe nothrow @nogc
GVec2!T yy() @safe nothrow @nogc
GVec2!T xy() @safe nothrow @nogc
GVec2!T yz() @safe nothrow @nogc
Float magnitudeSquared() @safe nothrow @nogc
Float magnitude() @safe nothrow @nogc
Float distanceTo(This to) @safe nothrow @nogc
This opBinary(IStr op)(This rhs) @safe nothrow @nogc
This opBinary(IStr op)(T rhs) @safe nothrow @nogc
This opBinaryRight(IStr op)(T lhs) @safe nothrow @nogc
This opUnary(IStr op : "-")() @safe nothrow @nogc
void opOpAssign(IStr op)(This rhs) @safe nothrow @nogc
void opOpAssign(IStr op)(T rhs) @safe nothrow @nogc
T min() @trusted @safe nothrow @nogc
T max() @trusted @safe nothrow @nogc
This _swizzleN(G)(const(G)[] args...) @trusted @safe nothrow @nogc
This _swizzleC(IStr args...) @trusted @safe nothrow @nogc
This swizzle(G)(const(G)[] args...) @trusted @safe nothrow @nogc
Constructors
this(T x, T y, T z)
this(T x)
this(GVec2!T xy, T z)
structGVec4(T)

A generic 4D vector.

Fields
T x
T y
T z
T w
formThe form of the vector.
zeroThe zero value of the vector.
oneThe one value of the vector.
lengthThe length of the vector.
Methods
IStr toStr() @trusted @safe nothrow @nogc
T[] items() @safe nothrow @nogc @trusted
bool isZero() @safe nothrow @nogc
bool isOne() @safe nothrow @nogc
GVec3!T chop() @safe nothrow @nogc
This abs() @safe nothrow @nogc
GVec2!T yx() @safe nothrow @nogc
GVec2!T xx() @safe nothrow @nogc
GVec2!T yy() @safe nothrow @nogc
GVec2!T xy() @safe nothrow @nogc
GVec2!T yz() @safe nothrow @nogc
Float magnitudeSquared() @safe nothrow @nogc
Float magnitude() @safe nothrow @nogc
Float distanceTo(This to) @safe nothrow @nogc
This opBinary(IStr op)(This rhs) @safe nothrow @nogc
This opBinary(IStr op)(T rhs) @safe nothrow @nogc
This opBinaryRight(IStr op)(T lhs) @safe nothrow @nogc
This opUnary(IStr op : "-")() @safe nothrow @nogc
void opOpAssign(IStr op)(This rhs) @safe nothrow @nogc
void opOpAssign(IStr op)(T rhs) @safe nothrow @nogc
T min() @trusted @safe nothrow @nogc
T max() @trusted @safe nothrow @nogc
This _swizzleN(G)(const(G)[] args...) @trusted @safe nothrow @nogc
This _swizzleC(IStr args...) @trusted @safe nothrow @nogc
This swizzle(G)(const(G)[] args...) @trusted @safe nothrow @nogc
Constructors
this(T x, T y, T z, T w)
this(T x)
this(GVec2!T xy, GVec2!T zw)
this(GVec3!T xyz, T w)
structGRect(P, S = P) if (P.sizeof >= S.sizeof)

A generic 2D rectangle.

Fields
GVec2!P position
GVec2!S size
Methods
IStr toStr() @trusted @safe nothrow @nogc
P x() @safe nothrow @nogc @trusted refThe X position of the rectangle.
P y() @safe nothrow @nogc @trusted refThe Y position of the rectangle.
S w() @safe nothrow @nogc @trusted refThe width of the rectangle.
S h() @safe nothrow @nogc @trusted refThe height of the rectangle.
bool hasSize() @safe nothrow @nogc
This abs() @safe nothrow @nogc
GVec2!P origin(Hook hook) @safe nothrow @nogc
GVec2!P point(Hook hook) @safe nothrow @nogc
GVec2!P topLeftPoint() @safe nothrow @nogc
GVec2!P topPoint() @safe nothrow @nogc
GVec2!P topRightPoint() @safe nothrow @nogc
GVec2!P leftPoint() @safe nothrow @nogc
GVec2!P centerPoint() @safe nothrow @nogc
GVec2!P rightPoint() @safe nothrow @nogc
GVec2!P bottomLeftPoint() @safe nothrow @nogc
GVec2!P bottomPoint() @safe nothrow @nogc
GVec2!P bottomRightPoint() @safe nothrow @nogc
This area(Hook hook) @safe nothrow @nogc
This centerArea() @safe nothrow @nogc
void fix() @safe nothrow @nogc
bool hasPoint(GVec2!P point) @safe nothrow @nogc
bool hasIntersection(This area) @safe nothrow @nogc
This intersection(This area) @safe nothrow @nogc
This merger(This area) @safe nothrow @nogc
P sliceX(P areaCount, P spacing = 0) @safe nothrow @nogc
P sliceY(P areaCount, P spacing = 0) @safe nothrow @nogc
This addLeft(P amount) @safe nothrow @nogc
This addRight(P amount) @safe nothrow @nogc
This addTop(P amount) @safe nothrow @nogc
This addBottom(P amount) @safe nothrow @nogc
This subLeft(P amount, P spacing = 0) @safe nothrow @nogc
This subRight(P amount, P spacing = 0) @safe nothrow @nogc
This subTop(P amount, P spacing = 0) @safe nothrow @nogc
This subBottom(P amount, P spacing = 0) @safe nothrow @nogc
This addLeftRight(P amount) @safe nothrow @nogc
This addTopBottom(P amount) @safe nothrow @nogc
This addAll(P amount) @safe nothrow @nogc
This subLeftRight(P amount) @safe nothrow @nogc
This subTopBottom(P amount) @safe nothrow @nogc
This subAll(P amount) @safe nothrow @nogc
Constructors
this(GVec2!P position, GVec2!S size)
this(GVec2!S size)
this(P x, P y, S w, S h)
this(S w, S h)
this(GVec2!P position, S w, S h)
this(P x, P y, GVec2!S size)
structGCirc(T)

A generic 2D Circle.

Fields
GVec2!T position
T radius
Methods
IStr toStr() @trusted @safe nothrow @nogc
T x() @safe nothrow @nogc @trusted refThe X position of the circle.
T y() @safe nothrow @nogc @trusted refThe Y position of the circle.
T r() @safe nothrow @nogc @trusted refThe radius of the circle.
bool hasSize() @safe nothrow @nogc
GCirc!T abs() @safe nothrow @nogc
Constructors
this(GVec2!T position, T radius)
this(T x, T y, T radius)
this(T radius)
structGLine(T)

A generic 2D Line.

Fields
GVec2!T a
GVec2!T b
Methods
IStr toStr() @trusted @safe nothrow @nogc
T x1() @safe nothrow @nogc @trusted ref
T y1() @safe nothrow @nogc @trusted ref
T x2() @safe nothrow @nogc @trusted ref
T y2() @safe nothrow @nogc @trusted ref
GLine!T abs() @safe nothrow @nogc
Constructors
this(GVec2!T a, GVec2!T b)
this(T ax, T ay, T bx, T by)
this(GVec2!T a, T bx, T by)
this(T ax, T ay, GVec2!T b)
structGTween(T)

Handles the transition between two values over a specified duration.

Fields
T a
T b
float time
float duration
Easing type
bool isYoyoing
Methods
bool isAtStart() @safe nothrow @nogcReturns true if time is at the start (0.0). Useful when using `TweenMode.bomb`.
bool isAtEnd() @safe nothrow @nogcReturns true if time is at the end (duration). Useful when using `TweenMode.bomb`.
T now() @safe nothrow @nogcReturns the current interpolated value between `a` and `b`.
T update(float delta) @safe nothrow @nogcAdvances the tween by the given delta time and returns the current value.
T reset() @safe nothrow @nogcResets the tween to the start and returns the current value.
float progress() @safe nothrow @nogcReturns the current progress (between 0.0 to 1.0).
void setProgress(float value) @safe nothrow @nogcSets the progress to a specific value (between 0.0 to 1.0).
void setTime(float value) @safe nothrow @nogcSets the current time and applies the tween mode rules.
Constructors
this(T a, T b, float duration, TweenMode mode = TweenMode.bomb, Easing type = Easing.linear)Creates a new tween.

Handles the transition between two boolean states.

Fields
float progress
bool state
Methods
bool isAtStart() @safe nothrow @nogcReturns true if progress is at the start (0.0).
bool isAtEnd() @safe nothrow @nogcReturns true if progress is at the end (1.0).
bool isActive() @safe nothrow @nogcReturns true if progress is not at the start (0.0) or the end (1.0).
float now() @safe nothrow @nogcReturns the current progress (between 0.0 and 1.0).
float update(float delta) @safe nothrow @nogcAdvances the progress toward the current state. Returns the updated progress.
float reset() @safe nothrow @nogcResets the progress to 0.0. Returns the updated progress.
void setProgress(float value) @safe nothrow @nogcSets the progress to the given value (clamped).
bool toggle() @safe nothrow @nogcToggles the target state. Returns the new state.
bool toggleSnap() @safe nothrow @nogcToggles the state and instantly sets progress to match. Returns the new state.
Constructors
this(bool state)Creates a new toggle.

Functions 162

fnT wrap(T)(T x, T a, T b) @trusted @safe nothrow @nogcReturns `x` wrapped to the range [`a`, `b`], wrapping around when out of bounds.
fnT snap(T)(T x, T step) @trusted @safe nothrow @nogcReturns `x` rounded to the nearest multiple of `step`.
fnfloat fmod(float x, float y) @trusted @safe nothrow @nogcReturns the floating-point remainder of `x / y`.
fndouble fmod64(double x, double y) @trusted @safe nothrow @nogcReturns the floating-point remainder of `x / y`.
fnfloat remainder(float x, float y) @trusted @safe nothrow @nogcReturns the IEEE 754 floating-point remainder of `x / y`.
fndouble remainder64(double x, double y) @trusted @safe nothrow @nogcReturns the IEEE 754 floating-point remainder of `x / y`.
fnfloat exp(float x) @trusted @safe nothrow @nogcReturns Euler's number `e` raised to the power of `x`.
fndouble exp64(double x) @trusted @safe nothrow @nogcReturns Euler's number `e` raised to the power of `x`.
fnfloat exp2(float x) @trusted @safe nothrow @nogcReturns `2` raised to the power of `x`.
fndouble exp264(double x) @trusted @safe nothrow @nogcReturns `2` raised to the power of `x`.
fnfloat log(float x) @trusted @safe nothrow @nogcReturns the natural logarithm of `x`.
fndouble log64(double x) @trusted @safe nothrow @nogcReturns the natural logarithm of `x`.
fnfloat log10(float x) @trusted @safe nothrow @nogcReturns the base-10 logarithm of `x`.
fndouble log1064(double x) @trusted @safe nothrow @nogcReturns the base-10 logarithm of `x`.
fnfloat log2(float x) @trusted @safe nothrow @nogcReturns the base-2 logarithm of `x`.
fndouble log264(double x) @trusted @safe nothrow @nogcReturns the base-2 logarithm of `x`.
fnfloat pow(float base, float exponent) @trusted @safe nothrow @nogcReturns `base` raised to the power of `exponent`.
fndouble pow64(double base, double exponent) @trusted @safe nothrow @nogcReturns `base` raised to the power of `exponent`.
fnfloat atan2(float y, float x) @trusted @safe nothrow @nogcReturns the angle between the positive x-axis and the point (`x`, `y`).
fndouble atan264(double y, double x) @trusted @safe nothrow @nogcReturns the angle between the positive x-axis and the point (`x`, `y`).
fnfloat roundNothing(float x) @trusted @safe nothrow @nogcReturns `x` unchanged.
fndouble roundNothing64(double x) @trusted @safe nothrow @nogcReturns `x` unchanged.
fnfloat floor(float x) @trusted @safe nothrow @nogcReturns the floor of `x`.
fndouble floor64(double x) @trusted @safe nothrow @nogcReturns the floor of `x`.
fnVec2 floor(Vec2 x) @trusted @safe nothrow @nogcReturns the floor of `x`.
fnVec3 floor(Vec3 x) @trusted @safe nothrow @nogcReturns the floor of `x`.
fnVec4 floor(Vec4 x) @trusted @safe nothrow @nogcReturns the floor of `x`.
fnDVec2 floor(DVec2 x) @trusted @safe nothrow @nogcReturns the floor of `x`.
fnDVec3 floor(DVec3 x) @trusted @safe nothrow @nogcReturns the floor of `x`.
fnDVec4 floor(DVec4 x) @trusted @safe nothrow @nogcReturns the floor of `x`.
fnRect floor(Rect x) @trusted @safe nothrow @nogcReturns the floor of `x`.
fnCirc floor(Circ x) @trusted @safe nothrow @nogcReturns the floor of `x`.
fnLine floor(Line x) @trusted @safe nothrow @nogcReturns the floor of `x`.
fnfloat round(float x) @trusted @safe nothrow @nogcReturns the nearest integer to `x`.
fndouble round64(double x) @trusted @safe nothrow @nogcReturns the nearest integer to `x`.
fnVec2 round(Vec2 x) @trusted @safe nothrow @nogcReturns the nearest integer to `x`.
fnVec3 round(Vec3 x) @trusted @safe nothrow @nogcReturns the nearest integer to `x`.
fnVec4 round(Vec4 x) @trusted @safe nothrow @nogcReturns the nearest integer to `x`.
fnDVec2 round(DVec2 x) @trusted @safe nothrow @nogcReturns the nearest integer to `x`.
fnDVec3 round(DVec3 x) @trusted @safe nothrow @nogcReturns the nearest integer to `x`.
fnDVec4 round(DVec4 x) @trusted @safe nothrow @nogcReturns the nearest integer to `x`.
fnRect round(Rect x) @trusted @safe nothrow @nogcReturns the nearest integer to `x`.
fnCirc round(Circ x) @trusted @safe nothrow @nogcReturns the nearest integer to `x`.
fnLine round(Line x) @trusted @safe nothrow @nogcReturns the nearest integer to `x`.
fnfloat ceil(float x) @trusted @safe nothrow @nogcReturns the ceiling of `x`.
fndouble ceil64(double x) @trusted @safe nothrow @nogcReturns the ceiling of `x`.
fnVec2 ceil(Vec2 x) @trusted @safe nothrow @nogcReturns the ceiling of `x`.
fnVec3 ceil(Vec3 x) @trusted @safe nothrow @nogcReturns the ceiling of `x`.
fnVec4 ceil(Vec4 x) @trusted @safe nothrow @nogcReturns the ceiling of `x`.
fnDVec2 ceil(DVec2 x) @trusted @safe nothrow @nogcReturns the ceiling of `x`.
fnDVec3 ceil(DVec3 x) @trusted @safe nothrow @nogcReturns the ceiling of `x`.
fnDVec4 ceil(DVec4 x) @trusted @safe nothrow @nogcReturns the ceiling of `x`.
fnRect ceil(Rect x) @trusted @safe nothrow @nogcReturns the ceiling of `x`.
fnCirc ceil(Circ x) @trusted @safe nothrow @nogcReturns the ceiling of `x`.
fnLine ceil(Line x) @trusted @safe nothrow @nogcReturns the ceiling of `x`.
fnfloat applyRounding(float x, Rounding type) @trusted @safe nothrow @nogcApplies the specified `type` of rounding to `x`.
fndouble applyRounding64(double x, Rounding type) @trusted @safe nothrow @nogcApplies the specified `type` of rounding to `x`.
fnVec2 applyRounding(Vec2 x, Rounding type) @trusted @safe nothrow @nogcApplies the specified `type` of rounding to `x`.
fnVec3 applyRounding(Vec3 x, Rounding type) @trusted @safe nothrow @nogcApplies the specified `type` of rounding to `x`.
fnVec4 applyRounding(Vec4 x, Rounding type) @trusted @safe nothrow @nogcApplies the specified `type` of rounding to `x`.
fnDVec2 applyRounding(DVec2 x, Rounding type) @trusted @safe nothrow @nogcApplies the specified `type` of rounding to `x`.
fnDVec3 applyRounding(DVec3 x, Rounding type) @trusted @safe nothrow @nogcApplies the specified `type` of rounding to `x`.
fnDVec4 applyRounding(DVec4 x, Rounding type) @trusted @safe nothrow @nogcApplies the specified `type` of rounding to `x`.
fnRect applyRounding(Rect x, Rounding type) @trusted @safe nothrow @nogcApplies the specified `type` of rounding to `x`.
fnCirc applyRounding(Circ x, Rounding type) @trusted @safe nothrow @nogcApplies the specified `type` of rounding to `x`.
fnLine applyRounding(Line x, Rounding type) @trusted @safe nothrow @nogcApplies the specified `type` of rounding to `x`.
fnfloat sqrt(float x) @trusted @safe nothrow @nogcReturns the square root of `x`.
fndouble sqrt64(double x) @trusted @safe nothrow @nogcReturns the square root of `x`.
fnfloat sin(float x) @trusted @safe nothrow @nogcReturns the sine of `x`.
fndouble sin64(double x) @trusted @safe nothrow @nogcReturns the sine of `x`.
fnfloat cos(float x) @trusted @safe nothrow @nogcReturns the cosine of `x`.
fndouble cos64(double x) @trusted @safe nothrow @nogcReturns the cosine of `x`.
fnfloat tan(float x) @trusted @safe nothrow @nogcReturns the tangent of `x`.
fndouble tan64(double x) @trusted @safe nothrow @nogcReturns the tangent of `x`.
fnfloat asin(float x) @trusted @safe nothrow @nogcReturns the arcsine of `x`.
fndouble asin64(double x) @trusted @safe nothrow @nogcReturns the arcsine of `x`.
fnfloat acos(float x) @trusted @safe nothrow @nogcReturns the arccosine of `x`.
fndouble acos64(double x) @trusted @safe nothrow @nogcReturns the arccosine of `x`.
fnfloat atan(float x) @trusted @safe nothrow @nogcReturns the arctangent of `x`.
fndouble atan64(double x) @trusted @safe nothrow @nogcReturns the arctangent of `x`.
fnfloat lerp(float from, float to, float weight) @trusted @safe nothrow @nogcReturns the linear interpolation between `from` and `to` by `weight`. A weight of 0 returns `from`, a weight of 1 returns `to`.
fndouble lerp64(double from, double to, double weight) @trusted @safe nothrow @nogcReturns the linear interpolation between `from` and `to` by `weight`. A weight of 0 returns `from`, a weight of 1 returns `to`.
fnfloat smoothstep(float from, float to, float weight) @trusted @safe nothrow @nogcReturns the smooth interpolation between `from` and `to` by `weight` using a cubic curve. Eases in and out, with zero first-order derivatives at both endpoints.
fndouble smoothstep64(double from, double to, double weight) @trusted @safe nothrow @nogcReturns the smooth interpolation between `from` and `to` by `weight` using a cubic curve. Eases in and out, with zero first-order derivatives at both endpoints.
fnfloat smootherstep(float from, float to, float weight) @trusted @safe nothrow @nogcReturns the smoother interpolation between `from` and `to` by `weight` using a quintic curve. Eases in and out, with zero first and second-order derivatives at both endpoints.
fndouble smootherstep64(double from, double to, double weight) @trusted @safe nothrow @nogcReturns the smoother interpolation between `from` and `to` by `weight` using a quintic curve. Eases in and out, with zero first and second-order derivatives at both endpoints.
fnfloat easeLinear(float x) @trusted @safe nothrow @nogcEasing function with no acceleration. Returns `x` unchanged.
fnfloat easeInSine(float x) @trusted @safe nothrow @nogcEasing function that starts slow and accelerates using a sine curve.
fnfloat easeOutSine(float x) @trusted @safe nothrow @nogcEasing function that starts fast and decelerates using a sine curve.
fnfloat easeInOutSine(float x) @trusted @safe nothrow @nogcEasing function that accelerates then decelerates using a sine curve.
fnfloat easeInCubic(float x) @trusted @safe nothrow @nogcEasing function that starts slow and accelerates using a cubic curve.
fnfloat easeOutCubic(float x) @trusted @safe nothrow @nogcEasing function that starts fast and decelerates using a cubic curve.
fnfloat easeInOutCubic(float x) @trusted @safe nothrow @nogcEasing function that accelerates then decelerates using a cubic curve.
fnfloat easeInQuint(float x) @trusted @safe nothrow @nogcEasing function that starts slow and accelerates using a quintic curve.
fnfloat easeOutQuint(float x) @trusted @safe nothrow @nogcEasing function that starts fast and decelerates using a quintic curve.
fnfloat easeInOutQuint(float x) @trusted @safe nothrow @nogcEasing function that accelerates then decelerates using a quintic curve.
fnfloat easeInCirc(float x) @trusted @safe nothrow @nogcEasing function that starts slow and accelerates along a circular arc.
fnfloat easeOutCirc(float x) @trusted @safe nothrow @nogcEasing function that starts fast and decelerates along a circular arc.
fnfloat easeInOutCirc(float x) @trusted @safe nothrow @nogcEasing function that accelerates then decelerates along a circular arc.
fnfloat easeInElastic(float x) @trusted @safe nothrow @nogcEasing function that overshoots the start with an elastic spring effect.
fnfloat easeOutElastic(float x) @trusted @safe nothrow @nogcEasing function that overshoots the end with an elastic spring effect.
fnfloat easeInOutElastic(float x) @trusted @safe nothrow @nogcEasing function that overshoots both ends with an elastic spring effect.
fnfloat easeInQuad(float x) @trusted @safe nothrow @nogcEasing function that starts slow and accelerates using a quadratic curve.
fnfloat easeOutQuad(float x) @trusted @safe nothrow @nogcEasing function that starts fast and decelerates using a quadratic curve.
fnfloat easeInOutQuad(float x) @trusted @safe nothrow @nogcEasing function that accelerates then decelerates using a quadratic curve.
fnfloat easeInQuart(float x) @trusted @safe nothrow @nogcEasing function that starts slow and accelerates using a quartic curve.
fnfloat easeOutQuart(float x) @trusted @safe nothrow @nogcEasing function that starts fast and decelerates using a quartic curve.
fnfloat easeInOutQuart(float x) @trusted @safe nothrow @nogcEasing function that accelerates then decelerates using a quartic curve.
fnfloat easeInExpo(float x) @trusted @safe nothrow @nogcEasing function that starts slow and accelerates exponentially.
fnfloat easeOutExpo(float x) @trusted @safe nothrow @nogcEasing function that starts fast and decelerates exponentially.
fnfloat easeInOutExpo(float x) @trusted @safe nothrow @nogcEasing function that accelerates then decelerates exponentially.
fnfloat easeInBack(float x) @trusted @safe nothrow @nogcEasing function that pulls back slightly before accelerating forward.
fnfloat easeOutBack(float x) @trusted @safe nothrow @nogcEasing function that overshoots the target before settling.
fnfloat easeInOutBack(float x) @trusted @safe nothrow @nogcEasing function that pulls back at the start and overshoots at the end.
fnfloat easeInBounce(float x) @trusted @safe nothrow @nogcEasing function that starts with a bouncing effect before reaching the target.
fnfloat easeOutBounce(float x) @trusted @safe nothrow @nogcEasing function that ends with a bouncing effect after reaching the target.
fnfloat easeInOutBounce(float x) @trusted @safe nothrow @nogcEasing function that bounces at both the start and end.
fnbool fequals(float a, float b, float localEpsilon = epsilon) @trusted @safe nothrow @nogcReturns true if `a` and `b` are within `localEpsilon` of each other.
fnbool fequals64(double a, double b, double localEpsilon = epsilon) @trusted @safe nothrow @nogcReturns true if `a` and `b` are within `localEpsilon` of each other.
fnbool fequals(Vec2 a, Vec2 b, float localEpsilon = epsilon) @trusted @safe nothrow @nogcReturns true if all components of `a` and `b` are within `localEpsilon` of each other.
fnbool fequals(Vec3 a, Vec3 b, float localEpsilon = epsilon) @trusted @safe nothrow @nogcReturns true if all components of `a` and `b` are within `localEpsilon` of each other.
fnbool fequals(Vec4 a, Vec4 b, float localEpsilon = epsilon) @trusted @safe nothrow @nogcReturns true if all components of `a` and `b` are within `localEpsilon` of each other.
fnfloat toRadians(float degrees) @trusted @safe nothrow @nogcConverts degrees to radians.
fndouble toRadians64(double degrees) @trusted @safe nothrow @nogcConverts degrees to radians.
fnfloat toDegrees(float radians) @trusted @safe nothrow @nogcConverts radians to degrees.
fndouble toDegrees64(double radians) @trusted @safe nothrow @nogcConverts radians to degrees.
fnIVec2 toIVec(Vec2 vec) @trusted @safe nothrow @nogcConverts a `Vec2` to an `IVec2` by truncating each component to an integer.
fnIVec3 toIVec(Vec3 vec) @trusted @safe nothrow @nogcConverts a `Vec3` to an `IVec3` by truncating each component to an integer.
fnIVec4 toIVec(Vec4 vec) @trusted @safe nothrow @nogcConverts a `Vec4` to an `IVec4` by truncating each component to an integer.
fnVec2 toVec(IVec2 vec) @trusted @safe nothrow @nogcConverts an `IVec2` to a `Vec2`.
fnVec2 toVec(GVec2!short vec) @trusted @safe nothrow @nogcConverts a `GVec2!short` to a `Vec2`.
fnVec3 toVec(IVec3 vec) @trusted @safe nothrow @nogcConverts an `IVec3` to a `Vec3`.
fnVec4 toVec(IVec4 vec) @trusted @safe nothrow @nogcConverts an `IVec4` to a `Vec4`.
fnVec4 toVec(Rgba color) @trusted @safe nothrow @nogcConverts an `Rgba` color to a `Vec4` with components in the order `(r, g, b, a)`.
fnIRect toIRect(Rect rect) @trusted @safe nothrow @nogcConverts a `Rect` to an `IRect` by truncating position and size components to integers.
fnRect toRect(IRect rect) @trusted @safe nothrow @nogcConverts an `IRect` to a `Rect`.
fnRect toRect(SRect rect) @trusted @safe nothrow @nogcConverts an `SRect` to a `Rect`.
fnRgba toRgb(uint rgb) @trusted @safe nothrow @nogcConverts a packed 24-bit RGB integer to an `Rgba` color with full opacity.
fnRgba toRgba(uint rgba) @trusted @safe nothrow @nogcConverts a packed 32-bit RGBA integer to an `Rgba` color.
fnRgba toRgba(Vec3 vec) @trusted @safe nothrow @nogcConverts a `Vec3` to an `Rgba` color, clamping each component to the range [0, 255] with full opacity.
fnRgba toRgba(Vec4 vec) @trusted @safe nothrow @nogcConverts a `Vec4` to an `Rgba` color, clamping each component to the range [0, 255].
fnRgba toRgba(IStr str) @trusted @safe nothrow @nogcConverts a hex color string (e.g. `"#RGB"`, `"RRGGBB"`, `"RRGGBBAA"`) to an `Rgba` color. Returns `Rgba()` if the string is invalid.
fnVec2 lerp(Vec2 from, Vec2 to, float weight) @trusted @safe nothrow @nogcReturns the linear interpolation between `from` and `to` by `weight`, applied per component.
fnVec3 lerp(Vec3 from, Vec3 to, float weight) @trusted @safe nothrow @nogcReturns the linear interpolation between `from` and `to` by `weight`, applied per component.
fnVec4 lerp(Vec4 from, Vec4 to, float weight) @trusted @safe nothrow @nogcReturns the linear interpolation between `from` and `to` by `weight`, applied per component.
fnRoundingFunc rounding(Rounding type) @trusted @safe nothrow @nogcReturns the rounding function corresponding to the given `Rounding` type.
fnRounding64Func rounding64(Rounding type) @trusted @safe nothrow @nogcReturns the 64-bit rounding function corresponding to the given `Rounding` type.
fnEasingFunc easing(Easing type) @trusted @safe nothrow @nogcReturns the easing function corresponding to the given `Easing` type.
fnfloat moveToState(float from, bool to, float delta) @trusted @safe nothrow @nogcMoves `from` toward 1 by `delta` if `to` is true, or toward 0 if false. Result is clamped to [0, 1].
fnfloat moveToState64(double from, bool to, double delta) @trusted @safe nothrow @nogcMoves `from` toward 1 by `delta` if `to` is true, or toward 0 if false. Result is clamped to [0, 1].
fnfloat followState(ref float weight, bool target, float speed) @trusted @safe nothrow @nogcMoves `weight` by ref toward the `target` state by `speed` and returns the updated value.
fndouble followState64(ref double weight, bool target, double speed) @trusted @safe nothrow @nogcMoves `weight` by ref toward the `target` state by `speed` and returns the updated value.
fnfloat moveTo(float from, float to, float delta) @trusted @safe nothrow @nogcMoves `from` toward `to` by at most `delta`, stopping exactly at `to`.
fnfloat moveTo64(double from, double to, double delta) @trusted @safe nothrow @nogcMoves `from` toward `to` by at most `delta`, stopping exactly at `to`.
fnVec2 moveTo(Vec2 from, Vec2 to, Vec2 delta) @trusted @safe nothrow @nogcMoves `from` toward `to` per component by at most `delta`, stopping exactly at `to`.
fnVec3 moveTo(Vec3 from, Vec3 to, Vec3 delta) @trusted @safe nothrow @nogcMoves `from` toward `to` per component by at most `delta`, stopping exactly at `to`.
fnVec4 moveTo(Vec4 from, Vec4 to, Vec4 delta) @trusted @safe nothrow @nogcMoves `from` toward `to` per component by at most `delta`, stopping exactly at `to`.
fnfloat moveToWithSlowdown(float from, float to, float delta, float slowdown) @trusted @safe nothrow @nogcMoves `from` toward `to` by `delta` each step, decelerating as it approaches using `slowdown`. A `slowdown` value around 0.1 gives a natural deceleration feel.
fnfloat moveToWithSlowdown64(double from, double to, double delta, double slowdown) @trusted @safe nothrow @nogcMoves `from` toward `to` by `delta` each step, decelerating as it approaches using `slowdown`. A `slowdown` value around 0.1 gives a natural deceleration feel.
fnVec2 moveToWithSlowdown(Vec2 from, Vec2 to, Vec2 delta, float slowdown) @trusted @safe nothrow @nogcMoves `from` toward `to` per component by `delta`, decelerating as it approaches using `slowdown`. A `slowdown` value around 0.1 gives a natural deceleration feel.
fnVec3 moveToWithSlowdown(Vec3 from, Vec3 to, Vec3 delta, float slowdown) @trusted @safe nothrow @nogcMoves `from` toward `to` per component by `delta`, decelerating as it approaches using `slowdown`. A `slowdown` value around 0.1 gives a natural deceleration feel.
fnVec4 moveToWithSlowdown(Vec4 from, Vec4 to, Vec4 delta, float slowdown) @trusted @safe nothrow @nogcMoves `from` toward `to` per component by `delta`, decelerating as it approaches using `slowdown`. A `slowdown` value around 0.1 gives a natural deceleration feel.

Variables 15

enumvarepsilon = 0.0001

The value of epsilon.

enumvareuler = 2.71828182845904523536028747135266249

The value of Euler's number.

enumvarlog2e = 1.44269504088896340735992468100189214

The value of log2(e).

enumvarlog10e = 0.43429448190325182765112891891660508

The value of log10(e).

enumvarln2 = 0.69314718055994530941723212145817656

The value of ln(2).

enumvarln10 = 2.30258509299404568401799145468436421

The value of ln(10).

enumvarpi = 3.14159265358979323846264338327950288

The value of PI.

enumvarpi2 = pi / 2.0

The value of PI / 2.

enumvarpi4 = pi / 4.0

The value of PI / 4.

enumvarpi180 = pi / 180.0

The value of PI / 180.

enumvardpi = 1.0 / pi

The value of 1 / PI.

enumvardpi2 = 2.0 / pi

The value of 2 / PI.

enumvardpi180 = 180.0 / pi

The value of 180 / PI.

enumvarsqrt2 = 1.41421356237309504880168872420969808

The value of sqrt(2).

enumvardsqrt2 = 0.70710678118654752440084436210484903

The value of 1 / sqrt(2).