Skip to content

Commit 6b5e087

Browse files
committed
Fix minor stupidity in singlestr implementation
1 parent 646619e commit 6b5e087

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/methods/clipping/clipping_processor.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ function _build_ab_list(alg::FosterHormannClipping, ::Type{T}, poly_a, poly_b, d
157157
return a_list, b_list, a_idx_list
158158
end
159159

160+
160161
"The number of vertices past which we should use a STRtree for edge intersection checking."
161162
const GEOMETRYOPS_NO_OPTIMIZE_EDGEINTERSECT_NUMVERTS = 32
162163
# Fallback convenience method so we can just pass the algorithm in
@@ -215,8 +216,10 @@ function foreach_pair_of_maybe_intersecting_edges_in_order(
215216
accelerator = if accelerator isa AutoAccelerator
216217
if na < GEOMETRYOPS_NO_OPTIMIZE_EDGEINTERSECT_NUMVERTS && nb < GEOMETRYOPS_NO_OPTIMIZE_EDGEINTERSECT_NUMVERTS
217218
NestedLoop()
219+
elseif na < GEOMETRYOPS_NO_OPTIMIZE_EDGEINTERSECT_NUMVERTS || nb < GEOMETRYOPS_NO_OPTIMIZE_EDGEINTERSECT_NUMVERTS
220+
SingleNaturalTree()
218221
else
219-
SingleSTRtree()
222+
DoubleNaturalTree()
220223
end
221224
else
222225
accelerator
@@ -276,7 +279,8 @@ function foreach_pair_of_maybe_intersecting_edges_in_order(
276279
# as the nested loop above, and iterating through poly_b in order.
277280
if Extents.intersects(ext_l, ext_b)
278281
empty!(query_result)
279-
SortTileRecursiveTree.query!(query_result, tree_b.rootnode, ext_l) # this is already sorted and uniqueified in STRtree.
282+
SortTileRecursiveTree.query!(query_result, tree_b.rootnode, ext_l) # this is already sorted and uniqueified in STRtree.'
283+
sort!(query_result)
280284
# Loop over the edges in b that might intersect the edges in a
281285
for j in query_result
282286
b1t, b2t = edges_b[j].geom
@@ -312,6 +316,7 @@ function foreach_pair_of_maybe_intersecting_edges_in_order(
312316
return f_on_each_maybe_intersect(((a1t, a2t), i), ((b1t, b2t), j)) # note the indices_b[j] here - we are using the index of the edge in the original edge list, not the index of the edge in the STRtree.
313317
end
314318
end
319+
isnothing(f_after_each_a) || f_after_each_a(a1t, i)
315320
end
316321

317322
elseif accelerator isa DoubleNaturalTree
@@ -347,8 +352,6 @@ function foreach_pair_of_maybe_intersecting_edges_in_order(
347352
end
348353
end
349354

350-
@show last_a_idx
351-
352355
if last_a_idx == 0 # the query did not find any intersections
353356
if !isnothing(f_on_each_a) && isnothing(f_after_each_a)
354357
return

0 commit comments

Comments
 (0)