server/geom.go

13 lines
269 B
Go

package main
import (
"bitbucket.org/hackerbots/vector"
)
func move(d1, d2 govector.Point2d, velocity float64, timeDelta float64) govector.Point2d {
v := d2.Sub(d1)
v_norm := v.Normalize()
v_scaled := v_norm.Scale(velocity * timeDelta)
return d1.Add(v_scaled)
}