Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add wiggle function to fix an invalidated position #1

Merged
merged 2 commits into from
Aug 6, 2020

Conversation

daef
Copy link
Contributor

@daef daef commented Aug 6, 2020

I've implemented a function (wiggle) to fix the element position for a single mutated element.

I'm not sure how bad the removal/insertion implementation is performance wise, but it seems to work okay across block-boundaries.

I'm going to try to use this in 21re/rust-geo-booleanop#17 where I think that one could know which element may offend the order criterion (namely the ones mutated by splitting)

@codecov-commenter
Copy link

codecov-commenter commented Aug 6, 2020

Codecov Report

Merging #1 into master will decrease coverage by 2.57%.
The diff coverage is 87.36%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #1      +/-   ##
==========================================
- Coverage   98.75%   96.17%   -2.58%     
==========================================
  Files           1        1              
  Lines         402      497      +95     
==========================================
+ Hits          397      478      +81     
- Misses          5       19      +14     
Impacted Files Coverage Δ
lib/src/array_stump.rs 96.17% <87.36%> (-2.58%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b65d30f...aef91b6. Read the comment docs.

@bluenote10
Copy link
Owner

Nice to see some activity on this ;)

I'm not sure how bad the removal/insertion implementation is performance wise, but it seems to work okay across block-boundaries.

Yes, in theory the main motivation of the data structure was to have something that allows fixing a position much faster than going through a whole remove + insert. Doing a remove + insert would also be possible on a tree, but from some preliminary benchmarks I felt that this is too costly, which is why I went for this array based solution. In practice we can assume that the rank fixes are small, so in terms of arrays we would only have to swap a small number of neighbouring elements. But I think we can see all that as a possible performance optimization and start with just going for remove + insert.

I'm going to try to use this in 21re/rust-geo-booleanop#17 where I think that one could know which element may offend the order criterion (namely the ones mutated by splitting)

From the 21re/rust-geo-booleanop#17 perspective I was expecting the interface of the "fix rank" function not to operate on a single element, but rather on either two (because if the algorithm splits something, it typically splits two segments, which both need to be rank-fixed), or even three (because the current segment might overlap with both the "above" and the "below" segments, so from the perspective of the outer loop there may be even three segments that had been mutated). From an algorithmic perspective I was never fully sure if it is better to fix the ranks one-by-one (potentially inefficient) or if such a "fix all rank mutations at once" approach is feasible.

But you seem to be more actively thinking about 21re/rust-geo-booleanop#17, so I'll simply support any attempt to get it fixed :).

@bluenote10 bluenote10 merged commit 7b7f3a4 into bluenote10:master Aug 6, 2020
@bluenote10
Copy link
Owner

FYI I've published a new version (0.2.1) in case that simplifies things for you.

@daef
Copy link
Contributor Author

daef commented Aug 10, 2020

That wasn't really needed, but is very much appreciated :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants