util

package
v0.1.122 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs(x float32) float32

Abs returns the absolute value of x.

func FastCbrt

func FastCbrt(x float32) float32

FastCbrt returns the cube root of x.

func FastCoerceIn

func FastCoerceIn[T ~float32 | ~int](value, min, max T) T

FastCoerceIn clamps the value between min and max.

func FastCoerceInInt

func FastCoerceInInt(value, min, max int) int

FastCoerceInInt clamps integer value between min and max.

func FloatToHalf

func FloatToHalf(f float32) uint16

FloatToHalf converts a float32 to a half-precision float (float16) represented as uint16.

func HalfToFloat

func HalfToFloat(h uint16) float32

HalfToFloat converts a half-precision float (float16) represented as uint16 to float32.

func Inverse3x3

func Inverse3x3(m []float32) []float32

Inverse3x3 returns the inverse of a 3x3 matrix.

func Mul3x3

func Mul3x3(lhs, rhs []float32) []float32

Mul3x3 multiplies two 3x3 matrices (lhs * rhs).

func Mul3x3Float3

func Mul3x3Float3(m []float32, v []float32) []float32

Mul3x3Float3 multiplies a 3x3 matrix (row-major flat array) by a 3-component vector. Result maps back to v.

func PackFloats

func PackFloats(v1, v2 float32) int64

PackFloats packs two float32 values into a single int64.

func PackInts

func PackInts(val1, val2 int32) int64

PackInts packs two int32 values into a single int64.

func Pow

func Pow(x, y float32) float32

Pow returns x**y.

func UnpackInt1

func UnpackInt1(value int64) int32

UnpackInt1 returns the first packed int32 from an int64.

func UnpackInt2

func UnpackInt2(value int64) int32

UnpackInt2 returns the second packed int32 from an int64.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL