Skip to content

Commit 495cad6

Browse files
committed
Fix #1050
1 parent 5f068a0 commit 495cad6

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/boundingboxes.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,19 @@ _bboxes(boxes) = _pboxes(point for box in boxes for point in extrema(box))
8787

8888
_pboxes(points) = _pboxes(manifold(first(points)), points)
8989

90+
function _pboxes(::Type{𝔼{1}}, points)
91+
p = first(points)
92+
= lentype(p)
93+
xmin = typemax(ℒ)
94+
xmax = typemin(ℒ)
95+
for p in points
96+
c = convert(Cartesian, coords(p))
97+
xmin = min(c.x, xmin)
98+
xmax = max(c.x, xmax)
99+
end
100+
Box(withcrs(p, (xmin,)), withcrs(p, (xmax,)))
101+
end
102+
90103
function _pboxes(::Type{𝔼{2}}, points)
91104
p = first(points)
92105
= lentype(p)

test/boundingboxes.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,9 @@
143143
g = CartesianGrid((10, 10), merc(0, 0), (T(1), T(1)))
144144
m = convert(SimpleMesh, g)
145145
@test crs(boundingbox(m)) === crs(m)
146+
147+
# 1D segment
148+
s = Segment(cart(0), cart(1))
149+
b = boundingbox(s)
150+
@test b == Box(cart(0), cart(1))
146151
end

0 commit comments

Comments
 (0)