diff --git a/image/path/path.go b/image/path/path.go index 92c0438..f70c0e2 100644 --- a/image/path/path.go +++ b/image/path/path.go @@ -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)) }