Skip to content

Commit 8a4a597

Browse files
committed
Add isempty
1 parent d019d84 commit 8a4a597

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "GeometryBasics"
22
uuid = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
33
authors = ["SimonDanisch <[email protected]>"]
4-
version = "0.3.4"
4+
version = "0.3.5"
55

66
[deps]
77
EarCut_jll = "5ae413db-bbd1-5e63-b57d-d24a61df00f5"

src/primitives/rectangles.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,13 @@ end
308308
###
309309
# set operations
310310

311+
"""
312+
isempty(h::Rect)
313+
314+
Return `true` if any of the widths of `h` are negative.
315+
"""
316+
Base.isempty(h::Rect{N,T}) where {N,T} = any(<(zero(T)), h.widths)
317+
311318
"""
312319
Perform a union between two Rects.
313320
"""

test/geometrytypes.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ end
105105
[2, 2, 2], [2, 2, 1], [1, 2, 1], [1, 2, 2]]
106106
@test decompose(Point{3,Int}, b) == pt_expb
107107
mesh = normal_mesh(b)
108+
109+
@test isempty(Rect{3,Float32}())
108110
end
109111

110112
NFace = NgonFace

0 commit comments

Comments
 (0)