Implement Axis targets.
This commit is contained in:
parent
ff38db6596
commit
2f7e11e8a2
6 changed files with 79 additions and 35 deletions
15
internal/mappingrules/math.go
Normal file
15
internal/mappingrules/math.go
Normal file
|
@ -0,0 +1,15 @@
|
|||
package mappingrules
|
||||
|
||||
import (
|
||||
"golang.org/x/exp/constraints"
|
||||
)
|
||||
|
||||
func AbsInt[T constraints.Integer](value T) T {
|
||||
return max(value, -value)
|
||||
}
|
||||
|
||||
// LerpInt linearly interpolates between two integer values using
|
||||
// a float64 index value
|
||||
func LerpInt[T constraints.Integer](min, max T, t float64) T {
|
||||
return T((1-t)*float64(min) + t*float64(max))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue