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

Order of decomposes coordinates is not counter/clockwise #2181

Open
yakir12 opened this issue Jul 25, 2022 · 5 comments · May be fixed by #4319
Open

Order of decomposes coordinates is not counter/clockwise #2181

yakir12 opened this issue Jul 25, 2022 · 5 comments · May be fixed by #4319
Labels
enhancement Feature requests and enhancements GeometryBasics

Comments

@yakir12
Copy link
Contributor

yakir12 commented Jul 25, 2022

The Point2fs that decompose(Point2f, Rect(0, 0, 1, 1)) returns are not sorted in a clockwise order (nor counter clockwise). This is not ideal because plotting a decomposed rectangle doesn't work:

poly(decompose(Point2f, Rect(0, 0, 1, 1)))

tmp
nor does plotting polygons with a hole:

using GeometryBasics
p = Polygon(decompose(Point2f, Rect(0, 0, 1, 1)), [decompose(Point2f, Circle(Point2f(0.5), 0.25))])
poly(p)

tmp

Only specifying the coordinates manually:

p = Polygon(Point2f[(0,0), (1,0), (1,1), (0,1)], [decompose(Point2f, Circle(Point2f(0.5), 0.25))])

worked:
tmp

@ffreyer
Copy link
Collaborator

ffreyer commented Aug 23, 2024

Should probably be considered in JuliaGeometry/GeometryBasics.jl#173

@ffreyer ffreyer added enhancement Feature requests and enhancements GeometryBasics labels Aug 23, 2024
@asinghvi17
Copy link
Member

Yeah, I've run into this issue as well....

@ffreyer
Copy link
Collaborator

ffreyer commented Aug 30, 2024

Right, this is probably going to be a part of that pr now. Question is which way? Does Cairo have a preference?

@ffreyer
Copy link
Collaborator

ffreyer commented Aug 30, 2024

I guess with reverse() existing it doesn't matter that much as long as it is consistent?

@asinghvi17
Copy link
Member

asinghvi17 commented Aug 30, 2024

If you're talking about geospatial, I can find you a standard which fits any winding order you might want to do :D but for now, we could go with the standard counterclockwise order? Cairo is fine with either CW or CCW.

Yeah consistency is definitely the key here!

@ffreyer ffreyer linked a pull request Sep 14, 2024 that will close this issue
24 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests and enhancements GeometryBasics
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

3 participants