JuliaGeometry / Meshes.jl

Computational geometry in Julia
https://juliageometry.github.io/MeshesDocs/stable
Other
389 stars 84 forks source link

Fibonacci lattice as additional sampling method #979

Open mcontim opened 1 month ago

mcontim commented 1 month ago

Hi,

I was looking at the available sampling algorithms in the package and I was wondering if it would be of interest adding an area preserving method for evenly distributing points on a sphere. I'm currently using the Fibonacci lattice for this task.

Let me know if you think this could be an interesting addition, so I can propose an implementation :)

juliohm commented 1 month ago

Hi Matteo, thanks for considering a contribution. You mean a new method for the HomogeneousSampling?

Em seg., 5 de ago. de 2024, 04:49, Matteo Conti @.***> escreveu:

Hi,

I was looking at the available sampling algorithms in the package and I was wondering if it would be of interest adding an area preserving method for evenly distributing points on a sphere. I'm currently using the Fibonacci lattice for this task.

Let me know if you think this could be an interesting addition, so I can propose an implementation :)

— Reply to this email directly, view it on GitHub https://github.com/JuliaGeometry/Meshes.jl/issues/979, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZQW3LUDFB2PUWFK2IAG4LZP4VAFAVCNFSM6AAAAABL7XUPCCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ2DOOBVHEYTEOA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

mcontim commented 1 month ago

Hi @juliohm!

Yes exactly, you're for sure more familiar than me with this method but here a quick reference: https://observablehq.com/@meetamit/fibonacci-lattices

That would be nice in order to have a "tesselation method" for the sphere, avoiding more complicated implementations like the icosahedral Goldberg polyhedra.

I work in SatCom and for example I use the Fibonacci lattice on a sphere to obtain a "grid" of points regularly distributed (preserving density per area) on Earth to collect statistics (of course here there is an approximation when you translate to lat-lon on the ellipsoid).

juliohm commented 1 month ago

That is great @mcontim. Appreciate if you can submit a PR for review. We need to figure out if this is a new case of the HomogeneousSampling or if it requires a new sampling method.

I understand that this algorithm you are interested in is deterministic, even though we can create some randomness as explained here: https://www.johndcook.com/blog/2023/08/12/fibonacci-lattice/

Let's brainstorm the best place in the PR.

mcontim commented 1 month ago

Thank you @juliohm for the quick reaction! I iwll submit a PR, then we can discuss on how to proceed :)

juliohm commented 1 month ago

@mcontim I think this method deserves a new FibonacciSampling struct. It works on various geometries as shown in the link you shared. It could be deterministic instead of random.

Did you have a chance to take a look into it?

mcontim commented 1 month ago

@juliohm I'm planning to work on the PR in the next couple of days (it was a busy week of coding this one :D ).

I agree on the new FibonacciSampling struct, however, I think the sampling will be a method limited to the only Sphere and Ball.

juliohm commented 1 month ago

I think the sampling will be a method limited to the only Sphere and Ball.

Thank you @mcontim, you mean that you only have time to contribute the Sphere case, right? That is nice already. Let me know if you need assistance with the codebase. Try to follow the code style as much as possible from the other sampling methods.