MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / Lerp

Function Lerp

math/lerp.go:5–8  ·  view source on GitHub ↗

Lerp or Linear interpolation This function will return new value in 't' percentage between 'v0' and 'v1'

(v0, v1, t float64)

Source from the content-addressed store, hash-verified

3// Lerp or Linear interpolation
4// This function will return new value in 't' percentage between 'v0' and 'v1'
5func Lerp(v0, v1, t float64) float64 {
6 // see: https://en.wikipedia.org/wiki/Linear_interpolation
7 return (1-t)*v0 + t*v1
8}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected