nppilot/rover/src/juju.net.nz/mathex/clip.go

14 lines
182 B
Go
Raw Permalink Normal View History

package mathex
// Clip a value between limits.
func Clipf(v, min, max float32) float32 {
switch {
case v < min:
return min
case v > max:
return max
default:
return v
}
}