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 comments explaining compute_bowyer_envelope! #38

Merged
merged 3 commits into from
Jul 28, 2024

Conversation

asinghvi17
Copy link
Contributor

@asinghvi17 asinghvi17 commented Jul 28, 2024

I was reading the code here and struggled a bit when interpreting it, so added some comments. Feel free to accept/reject/edit as necessary - some of these may be unnecessary.

Comment on lines 35 to 44
for i in 2:num_triangles(all_triangles)
v = get_adjacent(temp_adjacent, I(n + 1), v)
#=
Get the vertex associated with the edge `(point, points[v])` such that the
returned point (the new `v`) forms a positively oriented triangle
with that edge. Then, add the newly found `v` to the envelope.
To be clear, `n+1` is the index of the newly inserted vertex in the triangulation.
=#
v = get_adjacent(temp_adjacent, I(n + 1), v)
push!(envelope, v)
end
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not 100% sure what this loop is doing - is there some guarantee that all triangles added have n+1 as a vertex, and we're just getting each individual natural neighbour from this loop?

Copy link
Owner

Choose a reason for hiding this comment

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

That loop is building up the "envelope". All triangles will have n+1 as a vertex. I'll draw a picture

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gotcha - that's what I thought was happening but just wanted to confirm. Thanks!

Copy link
Owner

Choose a reason for hiding this comment

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

image

By pivoting around n+1 (which I've called i+1 in the image for some reason), we can traverse the boundary of the envelope counter-clockwise by looping over the triangles. The orientation is important since we compute areas later

@DanielVandH
Copy link
Owner

I also have some notes on this here https://juliageometry.github.io/DelaunayTriangulation.jl/dev/applications/interpolation/ and https://danielvandh.github.io/NaturalNeighbours.jl/dev/interpolation_math/. I don't know how much I talk about the internals in either of those links though. The documentation here isn't my best unfortunately

@DanielVandH DanielVandH merged commit 13b807d into DanielVandH:main Jul 28, 2024
3 checks passed
@DanielVandH
Copy link
Owner

Thanks!

@asinghvi17 asinghvi17 deleted the patch-1 branch July 28, 2024 16:16
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.

2 participants