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

Weiler atherton clipping method #999

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

jnemanja
Copy link

In draft because testing should have more cases and documentation probably needs some improvements. An extra commit is added with informal testing used during development, which is to be discarded before merge.

Copy link
Member

@juliohm juliohm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is an amazing contribution @jnemanja, thanks for putting the time into it. We will need to adjust the code over the week to match the style of the project, and to make sure that the behavior is correct.

Can you please address this first round of review below? Thank you!

src/intersections/polygons.jl Outdated Show resolved Hide resolved
test/intersections.jl Outdated Show resolved Hide resolved
test/scratchbooks/weileratherton.jl Outdated Show resolved Hide resolved
docs/src/algorithms/clipping.md Outdated Show resolved Hide resolved
@jnemanja jnemanja force-pushed the weiler-atherton-clipping branch from b49b6d7 to d9c1031 Compare August 17, 2024 08:17
@jnemanja jnemanja requested a review from juliohm August 17, 2024 09:19
test/intersections.jl Outdated Show resolved Hide resolved
@jnemanja jnemanja force-pushed the weiler-atherton-clipping branch from d9c1031 to 6772ec2 Compare August 18, 2024 15:26
@jnemanja jnemanja marked this pull request as ready for review August 18, 2024 15:33
Copy link
Member

@juliohm juliohm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another round of review related to code style before we can start reviewing the algorithm itself.

src/clipping/weileratherton.jl Outdated Show resolved Hide resolved
src/clipping/weileratherton.jl Outdated Show resolved Hide resolved
src/clipping/weileratherton.jl Outdated Show resolved Hide resolved
src/clipping/weileratherton.jl Outdated Show resolved Hide resolved
@jnemanja jnemanja force-pushed the weiler-atherton-clipping branch from 6772ec2 to 815c412 Compare August 25, 2024 15:42
Copy link
Member

@juliohm juliohm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jnemanja can you please rebase this PR to the latest master branch, and rename WeilerAtherton to WeilerAthertonClipping to be more explicit?

As we are preparing for a v1.0, we will be more careful with naming methods. We already renamed SutherlandHodgman to SutherlandHodgmanClipping for clariry.

docs/src/algorithms/clipping.md Outdated Show resolved Hide resolved
docs/src/algorithms/clipping.md Outdated Show resolved Hide resolved
docs/src/algorithms/clipping.md Outdated Show resolved Hide resolved
src/Meshes.jl Outdated Show resolved Hide resolved
src/clipping/weileratherton.jl Outdated Show resolved Hide resolved
@jnemanja jnemanja force-pushed the weiler-atherton-clipping branch 2 times, most recently from 9e66a2c to 7c147a1 Compare August 28, 2024 20:07
Copy link

codecov bot commented Aug 29, 2024

Codecov Report

Attention: Patch coverage is 91.40271% with 19 lines in your changes missing coverage. Please review.

Project coverage is 87.85%. Comparing base (243d3f0) to head (2a2f4cb).
Report is 13 commits behind head on master.

Files with missing lines Patch % Lines
src/clipping/weileratherton.jl 91.40% 19 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #999      +/-   ##
==========================================
+ Coverage   87.69%   87.85%   +0.16%     
==========================================
  Files         191      192       +1     
  Lines        6005     6226     +221     
==========================================
+ Hits         5266     5470     +204     
- Misses        739      756      +17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@jnemanja jnemanja force-pushed the weiler-atherton-clipping branch from 7c147a1 to bd5c309 Compare August 30, 2024 08:06
@jnemanja
Copy link
Author

Added tests to reach full coverage. Also, in the process I noticed that the order of rings in the polygons with holes is not always proper, so added a fix for that.

@jnemanja jnemanja force-pushed the weiler-atherton-clipping branch from bd5c309 to cacfb83 Compare August 30, 2024 08:28
@jnemanja
Copy link
Author

And rebased to latest again.

Copy link
Member

@juliohm juliohm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jnemanja thank you for the great work here, and for fixing the orientation of polygons in other unrelated tests.

In this second round of review I took a closer look into the implementation. I think we can simplify it a bit more, and reuse functionality in the auxiliary functions.

docs/src/algorithms/clipping.md Show resolved Hide resolved
docs/src/algorithms/clipping.md Outdated Show resolved Hide resolved
test/intersections.jl Outdated Show resolved Hide resolved
src/clipping/weileratherton.jl Outdated Show resolved Hide resolved
src/clipping/weileratherton.jl Outdated Show resolved Hide resolved
src/clipping/weileratherton.jl Outdated Show resolved Hide resolved
src/clipping/weileratherton.jl Outdated Show resolved Hide resolved
src/clipping/weileratherton.jl Outdated Show resolved Hide resolved
src/clipping/weileratherton.jl Outdated Show resolved Hide resolved
src/clipping/weileratherton.jl Outdated Show resolved Hide resolved
@jnemanja jnemanja force-pushed the weiler-atherton-clipping branch 2 times, most recently from 42c354f to 8cb00d7 Compare September 1, 2024 12:48
@jnemanja
Copy link
Author

jnemanja commented Sep 1, 2024

And rebased to the newest version.

src/clipping.jl Outdated Show resolved Hide resolved
src/clipping.jl Outdated Show resolved Hide resolved
@jnemanja jnemanja force-pushed the weiler-atherton-clipping branch from 8cb00d7 to 07778b0 Compare September 2, 2024 18:41
test/intersections.jl Outdated Show resolved Hide resolved
@jnemanja jnemanja force-pushed the weiler-atherton-clipping branch 2 times, most recently from 7df4f27 to e64b843 Compare September 12, 2024 08:24
src/Meshes.jl Outdated Show resolved Hide resolved
@jnemanja jnemanja force-pushed the weiler-atherton-clipping branch from e64b843 to 51955ff Compare September 12, 2024 14:08
@juliohm
Copy link
Member

juliohm commented Sep 18, 2024

@jnemanja did you have a chance to take a look into this PR?

@jnemanja
Copy link
Author

@jnemanja did you have a chance to take a look into this PR?

I am not aware of any additional issues I should address. If I missed something, could you point it out.

@juliohm
Copy link
Member

juliohm commented Sep 18, 2024

I believe that tests will fail with the latest commits, but I did trigger the bot again to be sure.

@jnemanja jnemanja force-pushed the weiler-atherton-clipping branch from 51955ff to fa40e3b Compare September 18, 2024 19:33
@jnemanja
Copy link
Author

I believe that tests will fail with the latest commits, but I did trigger the bot again to be sure.

The tests were successful, but the docs failed. Fixed that now and rebased to the newest release.

test/intersections.jl Outdated Show resolved Hide resolved
@jnemanja jnemanja force-pushed the weiler-atherton-clipping branch 3 times, most recently from e9d2e4f to bc00ca3 Compare September 21, 2024 10:34
@jnemanja jnemanja force-pushed the weiler-atherton-clipping branch from bc00ca3 to 2a2f4cb Compare November 12, 2024 20:35
@jnemanja jnemanja force-pushed the weiler-atherton-clipping branch from 2a2f4cb to db1fae7 Compare December 8, 2024 16:50
test/clipping.jl Outdated
Comment on lines 173 to 174
# Tolerances are not properly retrieved for Float32 types, so need to pass them explicitly.
atol_el = coords(cart(0.0)).x
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jnemanja could you please elaborate on this tolerance issue? Why can't we use the default atol in the following test?

@jnemanja jnemanja force-pushed the weiler-atherton-clipping branch from db1fae7 to 7309ea3 Compare December 20, 2024 14:09
Improve clipping in clipped test
Improve points deduplication and removal of repeated entering vertices
@jnemanja jnemanja force-pushed the weiler-atherton-clipping branch from 7309ea3 to 72411c3 Compare December 20, 2024 16:11
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