experimental UnitSpherical module that can express geometry on unit sphere#285
Merged
asinghvi17 merged 34 commits intomainfrom Sep 17, 2025
Merged
experimental UnitSpherical module that can express geometry on unit sphere#285asinghvi17 merged 34 commits intomainfrom
asinghvi17 merged 34 commits intomainfrom
Conversation
This was referenced Apr 3, 2025
Member
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
3d14dc5 to
6118f5e
Compare
16cf9b4 to
00ff75c
Compare
1f5fba2 to
f33c8e4
Compare
meggart
reviewed
Apr 4, 2025
Member
Author
|
For this to work well, we'll probably want to port a lot of the stuff from s2, like https://github.com/google/s2geometry/blob/58de4ea1e2f8a294e0c072c602c22232fd1433ad/src/s2/s1chord_angle.h - it's Apache 2.0 licensed so we can directly port it. They have a good framework to handle this stuff, so if we can get the basics sorted then we're mostly there I believe. That would also be a good foundation to build an s2 indexing framework in Julia, since we would have all the basic components already. |
Merged
f33c8e4 to
2ca2a3c
Compare
747b248 to
6e8baa1
Compare
asinghvi17
commented
May 10, 2025
asinghvi17
commented
May 10, 2025
Member
Author
|
The next thing on my list is an iterator over all stable (no edges near 180 degrees) triangles of a linear ring, like what s2 does. |
The idea is that to compare distances for intersects etc. you can do all operations in the cartesian space instead of the spherical space in some cases, eliminating the need for a trig function.
…g case (trait, point) This didn't happen earlier meaning that "caching" did not work
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

TL;DR
Wrote a new
UnitSpherical.jlmodule (experimental) for working with points on the unit sphere and spherical caps.What changed?
Created a new file
UnitSpherical.jlthat implements:UnitSphericalPointstruct for representing points on the unit sphere (S²) using Cartesian coordinates in ℝ³SphericalCapstruct for representing spherical capsspherical_distancefor calculating distances between pointsslerpfor spherical linear interpolationcircumcenter_on_unit_spherefor finding the center of a circle passing through three points: still brokenangle_betweenfor calculating angles between pointsrandspherefor generating random points on the unit sphereQuick start
Import the module and create unit spherical points:
Test spherical caps and operations:
Generate random points on the sphere:
This should provide a nice foundation to start looking at R-trees that are backed by spherical caps, not extents, in preparation for @meggart's work involving this. With the new changes to
as/treesSpatialTreeInterface is now representation agnostic, meaning that as long as the predicate you passed in can consume the extent like object you have chosen, any extent like thing (accessible bySpatialTreeInterface.node_extent) can be used by the STI algorithms.