From 76e2fb2f8295567019753f7fc334ffedd950f60a Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Mon, 15 Jan 2024 17:58:55 +0100 Subject: [PATCH] Add Geom.ClipByBounds --- geom.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/geom.go b/geom.go index cf14bdb8c..ad6580edb 100644 --- a/geom.go +++ b/geom.go @@ -54,6 +54,10 @@ func (g *Geom) MakeValidWithParams(method MakeValidMethod, collapse MakeValidCol return g.context.newGeom(cRes, nil) } +func (g *Geom) ClipByBounds(bounds *Bounds) *Geom { + return g.ClipByRect(bounds.MinX, bounds.MinY, bounds.MaxX, bounds.MaxY) +} + // CoordSeq returns g's coordinate sequence. func (g *Geom) CoordSeq() *CoordSeq { g.mustNotBeDestroyed()