uses a Hierarchical Triangular Mesh to organize points on the unit sphere.

Overview

Start by covering the unit sphere with eight triangles; four in the north and four in the south. This is level 0. Divide each of these into its four children. This is level 1. And so on. Each of these "triangles" or "trixels" is specified by a long number of 64 bits.

A ConvexRegion on the unit sphere can be described by a small circle or by a set of points joined by arcs of great circles. The method addToRange returns an iterable HTMrange which contains the HTM ids of the trixels that fill up the ConvexRegion.

A nice property of these HTM ids is that at a specified level, the HTM id values for nearby trixels tend be be near each other. Thus, if you sort a set of locations on the unit sphere by their HTM id values at a specified level, searching for locations within a ConvexRegion can be reduced to searching for a modest set of HTM id ranges.

Credits

This original code was copied from the edu.jhu.htm package, originally written by Wil O'Mullane, Peter Kunszt, and George Fekete.

We have made substantial changes intended to simplify the code and improve reliability.

To read up on what the HTM Index is and what it is used for, please visit the HTM Home Page at the Johns Hopkins University.