WithPoint includes a new point to the CartesianBoundingBox. It will edit any bounding box in place.
(x, y float64)
| 99 | // WithPoint includes a new point to the CartesianBoundingBox. |
| 100 | // It will edit any bounding box in place. |
| 101 | func (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. |
no test coverage detected