Skip to content

Conversation

asinghvi17
Copy link
Contributor

@asinghvi17 asinghvi17 commented Oct 30, 2024

This method assumes three things:

  • The first three points in the polygon are not NaN
  • The first three points in the polygon are all different
  • The polygon lies in a single plane, that can be described by its first three points

It simply creates a plane from the first three points of the polygon, and projects the rest of the polygon onto it. Then, EarCut can triangulate the polygon by the usual method for 2D.

This will enable plotting 3D polygons in GLMakie and WGLMakie with no extra steps, CairoMakie needs some more fixes it seems. But we're getting there!

Fixes MakieOrg/Makie.jl#4015, and the other issue someone raised about a set of polygons in 3D that I can't find anymore.

Probably needs tests, but not sure what a good test suite would be? Ideas appreciated :)

cc @milankl - this is the algorithm I sent you on Slack

This method assumes two things:
- The first three points in the polygon are not NaN
- The first three points in the polygon are all different
- The polygon lies in a single plane, that can be described by its first three points
@asinghvi17
Copy link
Contributor Author

This might be better placed in Makie - closing for now.

@asinghvi17 asinghvi17 closed this Nov 14, 2024
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.

poly(::Vector{Point3f}) fails
1 participant