Add Translate function
This commit is contained in:
parent
1f04d688cf
commit
14c4db9d16
@ -74,6 +74,13 @@ func DistanceToLine (point, line1, line2 image.Point) float64 {
|
||||
return triangle / Distance(line1, line2)
|
||||
}
|
||||
|
||||
// Translate adds delta to all points in path. This modifies the slice contents.
|
||||
func Translate (delta image.Point, path []image.Point) {
|
||||
for index, point := range path {
|
||||
path[index] = point.Add(delta)
|
||||
}
|
||||
}
|
||||
|
||||
func lerp (fac float64, x, y int) int {
|
||||
return int(float64(x) * fac + float64(y) * (1.0 - fac))
|
||||
}
|
||||
|
Reference in New Issue
Block a user