Documentation
¶
Index ¶
- Variables
- func Abs[T constraints.Float | constraints.Integer](v T) T
- func Acos(x float32) float32
- func Asin(x float32) float32
- func Atan2(y, x float32) float32
- func Ceil(x float32) float32
- func Clamp[T constraints.Ordered](v, min, max T) T
- func Copysign(f, sign float32) float32
- func Cos(x float32) float32
- func DegToRad(deg float32) float32
- func Equal(a, b float32) bool
- func EqualThreshold(a, b, epsilon float32) bool
- func Floor(x float32) float32
- func Lerp(a, b, f float32) float32
- func Max[T constraints.Ordered](a, b T) T
- func Min[T constraints.Ordered](a, b T) T
- func Mod(x, y float32) float32
- func Pow(f, x float32) float32
- func RadToDeg(rad float32) float32
- func Round(f float32) float32
- func Sign(x float32) float32
- func Sin(x float32) float32
- func Sincos(x float32) (float32, float32)
- func Snap(f, multiple float32) float32
- func Sqrt(x float32) float32
- func Tan(x float32) float32
- type Noise
Constants ¶
This section is empty.
Variables ¶
View Source
var ( MinNormal = float32(1.1754943508222875e-38) // 1 / 2**(127 - 1) MinValue = float32(math.SmallestNonzeroFloat32) MaxValue = float32(math.MaxFloat32) InfPos = float32(math.Inf(1)) InfNeg = float32(math.Inf(-1)) NaN = float32(math.NaN()) E = float32(math.E) Pi = float32(math.Pi) PiOver2 = Pi / 2 PiOver4 = Pi / 4 Sqrt2 = float32(math.Sqrt2) Epsilon = float32(1e-10) )
Various useful constants.
Functions ¶
func Abs ¶
func Abs[T constraints.Float | constraints.Integer](v T) T
Abs returns the absolute value of a number
func Clamp ¶
func Clamp[T constraints.Ordered](v, min, max T) T
Clamp a value between a minimum and a maximum value
func EqualThreshold ¶
EqualThreshold is a utility function to compare floats. It's Taken from http://floating-point-gui.de/errors/comparison/
It is slightly altered to not call Abs when not needed.
This differs from FloatEqual in that it lets you pass in your comparison threshold, so that you can adjust the comparison value to your specific needs
Types ¶
Directories
¶
Path | Synopsis |
---|---|
Based on code from github.com/go-gl/mathgl: Copyright 2014 The go-gl Authors.
|
Based on code from github.com/go-gl/mathgl: Copyright 2014 The go-gl Authors. |
Based on code from github.com/go-gl/mathgl: Copyright 2014 The go-gl Authors.
|
Based on code from github.com/go-gl/mathgl: Copyright 2014 The go-gl Authors. |
Click to show internal directories.
Click to hide internal directories.