Skip to content

Commit

Permalink
Revert breaking changes on DelaunayTessellation iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
dkarrasch committed May 20, 2022
1 parent daddf7b commit 492c1d1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "VoronoiDelaunay"
uuid = "72f80fcb-8c52-57d9-aff0-40c1a3526986"
version = "0.4.1"
version = "0.4.2"

[deps]
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
Expand Down
19 changes: 12 additions & 7 deletions src/VoronoiDelaunay.jl
Original file line number Diff line number Diff line change
Expand Up @@ -278,17 +278,22 @@ function voronoiedgeswithoutgenerators(t::DelaunayTessellation2D)
VoronoiEdgeIteratorWithoutGenerator(t)
end

# TODO: for v0.5, remove TrigIter
mutable struct TrigIter
ix::Int64
end

function iterate(t::DelaunayTessellation2D, ix::Int=2)
while ix <= t._last_trig_index && isexternal(@inbounds t._trigs[ix])
ix += 1
# TODO: for v0.5, replace it by ix::Int
function iterate(t::DelaunayTessellation2D, it::TrigIter=TrigIter(2))
while it.ix <= t._last_trig_index && isexternal(@inbounds t._trigs[it.ix])
it.ix += 1
end
if ix > t._last_trig_index
if it.ix > t._last_trig_index
return nothing
end
trig = t._trigs[ix]
ix += 1
return (trig, ix)
trig = t._trigs[it.ix]
it.ix += 1
return (trig, it)
end

function findindex(tess::DelaunayTessellation2D{T}, p::T) where T<:AbstractPoint2D
Expand Down

0 comments on commit 492c1d1

Please sign in to comment.