atl/sm/util
import "atl/sm/util"sm.util: interpolation, hashing and UTF-8 helpers.
Functions
Section titled "Functions"func Smoothstep(edge0, edge1, x float64) float64Smooth Hermite step from 0 at edge0 to 1 at edge1. See also sm.Lerp and sm.Clamp.
func Smootherstep(edge0, edge1, x float64) float64Like Smoothstep, with zero first and second derivatives at the edges.
func PositiveModulo(x, n int) intx mod n, always in 0..n-1 (unlike Go's %).
func Bezier2(c0, c1, c2, t float64) float64Quadratic Bezier interpolation of scalars at t (0..1).
func Bezier3(c0, c1, c2, c3, t float64) float64Cubic Bezier interpolation of scalars at t (0..1).
func Easing(curve string, p float64) float64An easing curve by name ("easeInOutQuad", "easeOutBounce", ...) at progress p (0..1).
func AxesToQuat(xAxis, yAxis sm.Vec3) sm.QuatA rotation from two perpendicular axes.
func Hash(values ...any) intThe engine's hash of any values, stable across clients.
func GeometricMedian(points []sm.Vec3, initialGuess *sm.Vec3, iterations *int) sm.Vec3An approximation of the point with the smallest total distance to points.
func Utf8Length(s string) intLength of UTF-8 text in characters, not bytes.
func Utf8Clamp(s string, maxChars int) stringUTF-8 text cut to at most maxChars characters.