diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2025-07-25 12:20:07 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2025-07-25 12:20:07 +0200 |
| commit | 34455230043d42e4324fc27483688a856851d65d (patch) | |
| tree | 967f1d30f471946ab2843e8023755becd7381075 /physics | |
| parent | a4db8814ccb2fc255bd909d8fa827ba23896322f (diff) | |
refactor: ECS bounds
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}), |
