-
Notifications
You must be signed in to change notification settings - Fork 9
experimental UnitSpherical module that can express geometry on unit sphere #285
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
Conversation
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
|
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. |
f33c8e4 to
2ca2a3c
Compare
747b248 to
6e8baa1
Compare
|
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

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.