MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / WithPoint

Method WithPoint

pkg/geo/bbox.go:101–119  ·  view source on GitHub ↗

WithPoint includes a new point to the CartesianBoundingBox. It will edit any bounding box in place.

(x, y float64)

Source from the content-addressed store, hash-verified

99// WithPoint includes a new point to the CartesianBoundingBox.
100// It will edit any bounding box in place.
101func (b *CartesianBoundingBox) WithPoint(x, y float64) *CartesianBoundingBox {
102 if b == nil {
103 return &CartesianBoundingBox{
104 BoundingBox: geopb.BoundingBox{
105 LoX: x,
106 HiX: x,
107 LoY: y,
108 HiY: y,
109 },
110 }
111 }
112 b.BoundingBox = geopb.BoundingBox{
113 LoX: math.Min(b.LoX, x),
114 HiX: math.Max(b.HiX, x),
115 LoY: math.Min(b.LoY, y),
116 HiY: math.Max(b.HiY, y),
117 }
118 return b
119}
120
121// AddPoint adds a point to the CartesianBoundingBox coordinates.
122// Returns a copy of the CartesianBoundingBox.

Callers 1

Calls 2

MinMethod · 0.65
MaxMethod · 0.65

Tested by

no test coverage detected