diff options
Diffstat (limited to 'physics')
| -rw-r--r-- | physics/geometry.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/physics/geometry.go b/physics/geometry.go index 9949466..07a41e3 100644 --- a/physics/geometry.go +++ b/physics/geometry.go @@ -20,6 +20,13 @@ func Normalize(p Point) Point { return p.Div(int(Length(p))) } +func Translate(r Rectangle, offset Point) Rectangle { + return Rectangle{ + Min: r.Min.Add(offset), + Max: r.Max.Add(offset), + } +} + func AdjacentPoints(from Point) []Point { return []Point{ from.Add(Point{X: 0, Y: -100}), |
