示例#1
0
文件: mathf.go 项目: go3d/go-ngine
func Mathf_LerpAngle(a, b, t float64) (r float64) {
	if r = Mathf_Repeat(b-a, 360); r > 180 {
		r -= 360
	}
	r = unum.Clamp01(t)*r + a
	return
}
示例#2
0
文件: mathf.go 项目: go3d/go-ngine
func Mathf_Lerp(from, to, t float64) float64 {
	return unum.Clamp01(t)*(to-from) + from
}
示例#3
0
文件: mathf.go 项目: go3d/go-ngine
func Mathf_SmoothStep(from, to, t float64) float64 {
	t = unum.Clamp01(t)
	t = -2*t*t*t + 3*t*t
	return to*t + from*(1-t)
}