server/geom.go

13 lines
269 B
Go
Raw Normal View History

2013-09-28 09:44:47 -07:00
package main
import (
"bitbucket.org/hackerbots/vector"
)
func move(d1, d2 govector.Point2d, velocity float32, timeDelta float32) govector.Point2d {
2013-09-28 09:44:47 -07:00
v := d2.Sub(d1)
v_norm := v.Normalize()
v_scaled := v_norm.Scale(velocity * timeDelta)
return d1.Add(v_scaled)
}