Skip to content

Commit e3921ec

Browse files
committed
more doc strings/comments
1 parent 780f210 commit e3921ec

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

src/regions.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ center(a::Rect{T,N}) where {T,N} =
135135
end
136136

137137
"""
138+
intersects(a::Region{T,N}, b::Region{T,N}) where {T,N}
139+
138140
Check whether `a` intersects with `b`.
139141
"""
140142
@generated intersects(a::Rect{T,N}, b::Rect{T,N}) where {T,N} =
@@ -143,7 +145,9 @@ Check whether `a` intersects with `b`.
143145
end
144146

145147
"""
146-
Check whether `b` is contained inside `a`.
148+
contains(a::Region{T,N}, b::Region{T,N}) where {T,N}
149+
150+
Check whether `a` contains `b`.
147151
"""
148152
@generated contains(a::Rect{T,N}, b::Rect{T,N}) where {T,N} =
149153
quote
@@ -156,6 +160,8 @@ Check whether `b` is contained inside `a`.
156160
end
157161

158162
"""
163+
in(a::Region{T,N}, b::Region{T,N}) where {T,N}
164+
159165
Check whether `a` is contained inside `b`.
160166
"""
161167
Base.in(a::Rect, b::Rect) = contains(b, a)
@@ -166,6 +172,8 @@ Base.:(==)(a::Point, b::Rect) = a.coord == b.low == b.high
166172
Base.:(==)(a::Rect, b::Point) = b == a
167173

168174
"""
175+
touches(a::Rect{T,N}, b::Rect{T,N}) where {T,N}
176+
169177
Check whether `a` and `b` touch
170178
(i.e. any `low` side touches `low` or `high` touches `high`).
171179
"""

src/rtree/check.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
nelements(node::Leaf) = length(node)
22
nelements(node::Branch) = sum(nelements, children(node))
33

4+
# check the R-tree node (branch or leaf):
5+
# * the parent
6+
# * the level
7+
# * the number of attached elements
8+
# * element id uniqueness
9+
# * the MBR (should fit the MBR of children)
410
function check(node::Node{T,N,V}, tree::RTree{T,N,V},
511
nnodes_perlevel::AbstractVector{Int}, ids::Union{Set, Nothing}) where {T,N,V}
612
nnodes_perlevel[level(node) + 1] += 1
@@ -28,7 +34,7 @@ function check(node::Node{T,N,V}, tree::RTree{T,N,V},
2834
end
2935

3036
# check the tree:
31-
# * the parent
37+
# * the root
3238
# * the height
3339
# * the number of elements
3440
# * the number of nodes per level

src/rtree/delete.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function Base.delete!(tree::RTree{T,N}, br::Rect{T,N}, id::Any = nothing) where
99
leafx = findleaf(tree, br, id)
1010
leafx === nothing && __spatial_keyerror(eltype(tree), br, id)
1111
_detach!(leafx[1], leafx[2], tree)
12-
tmpdetached = Vector{nodetype(tree)}() # FIXME Union{Leaf,Branch} ?
12+
tmpdetached = Vector{nodetype(tree)}() # FIXME use pool, Union{Leaf,Branch} ?
1313
_condense!(leafx[1], tree, tmpdetached)
1414
_reinsert!(tree, tmpdetached)
1515
tree.nelems -= 1

0 commit comments

Comments
 (0)