Skip to main content

A spherical geometry library.

Project description

sphgeom: spherical geometry primitives

Overview

This low-level C++ library provides primitives for representing points and regions on the unit sphere, as well as support for partitioning the sphere. It can be used to answer the following sorts of questions:

  • Is point X inside region Y?
  • Do two regions A and B intersect?
  • Which pieces of the sphere does region C overlap?

Regions can be serialized to binary strings, so that they may be stored efficiently in files or VARBINARY database columns. They can also be approximated with simpler regions - for example, one can ask for the bounding circle of a convex polygon.

Python bindings that expose most of the C++ API are also provided via pybind11.

Points

There are 3 different classes for points

  • LonLat for spherical coordinates,
  • Vector3d for Cartesian vectors in ℝ³ (not constrained to lie on the unit sphere)
  • UnitVector3d for vectors in ℝ³ with unit ℓ² norm.

Regions

Four basic spherical Region types are provided:

  • Box, a longitude/latitude angle box
  • Circle, a small circle defined by a center and opening angle/chord length
  • Ellipse, the intersection of an elliptical cone with the unit sphere
  • ConvexPolygon, a convex spherical polygon with unit vector vertices and great circle edges

In addition to the spherical regions, there is a type for 3-D axis aligned boxes, Box3d. All spherical regions know how to compute their 3-D bounding boxes, which makes it possible to insert them into a 3-D R-tree. This is used by the exposure indexing task in the daf_ingest package to spatially index exposure bounding polygons using the SQLite 3 R*tree module.

A region can also determine its spatial relationship to another region, and test whether or not it contains a given unit vector.

Pixelizations

This library also provides support for assigning points to pixels (a.k.a. cells or partitions) in a Pixelization (a.k.a. partitioning) of the sphere, and for determining which pixels intersect a region.

Currently, the Chunker class implements the partitioning scheme employed by Qserv. The HtmPixelization class implements the HTM (Hierarchical Triangular Mesh) pixelization. The Q3cPixelization and Mq3cPixelization classes implement the original Quad Tree Cube indexing scheme and a modified version with reduced pixel area variation.

Installing with pip

A simple pip-compatible installer is available. This only installs the Python bindings and the resulting installation is not usable for linking from C++. Some metadata (in particular the version number) are not set properly for the distribution. The main purpose for now is to allow other packages to pip install from the GitHub URL in their CI systems where sphgeom is a dependency.

See Also

Contributing

For instructions on how to contribute, see http://dm.lsst.org/#contributing (or just send us a pull request).

Support

For help, see http://dm.lsst.org/#support.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lsst-sphgeom-26.0.0a20230300.tar.gz (129.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

lsst_sphgeom-26.0.0a20230300-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (660.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

lsst_sphgeom-26.0.0a20230300-cp310-cp310-macosx_11_0_arm64.whl (492.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-26.0.0a20230300-cp310-cp310-macosx_10_9_x86_64.whl (513.6 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

lsst_sphgeom-26.0.0a20230300-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (662.2 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

lsst_sphgeom-26.0.0a20230300-cp39-cp39-macosx_11_0_arm64.whl (492.2 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

lsst_sphgeom-26.0.0a20230300-cp39-cp39-macosx_10_9_x86_64.whl (513.7 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

lsst_sphgeom-26.0.0a20230300-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (654.7 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

lsst_sphgeom-26.0.0a20230300-cp38-cp38-macosx_11_0_arm64.whl (491.9 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

lsst_sphgeom-26.0.0a20230300-cp38-cp38-macosx_10_9_x86_64.whl (513.5 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

File details

Details for the file lsst-sphgeom-26.0.0a20230300.tar.gz.

File metadata

  • Download URL: lsst-sphgeom-26.0.0a20230300.tar.gz
  • Upload date:
  • Size: 129.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for lsst-sphgeom-26.0.0a20230300.tar.gz
Algorithm Hash digest
SHA256 c7858b69505230ae21a71f917322cee44617098252832dfc3aeca5865578d106
MD5 09694c838e7783468a4c8a4824c52c1d
BLAKE2b-256 faf7f2e549b2da7a01fa5f4e401c5b3c6957a62056f55ad2045a5b488b04eea5

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.0a20230300-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230300-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 582dc1ee28ed9c6bc594dd1171706b16bf5ca8231e940bffcf3a9b7cc4e586a5
MD5 985953a08ccd1fb2877e1d6d659459d7
BLAKE2b-256 3de64365092accc903310ad178f7759eab26e49b82db314ee656ff535b2b42ea

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.0a20230300-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230300-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1fed5f1a129923d92acaf8d2fc40d06b423a8410dccb5f53d81177325875c061
MD5 b94270c2f71d343c2d2c566d61eefdee
BLAKE2b-256 d88a56e103507e21b2fc2554e7f744942d88ebaa113c70ed219e0c8f7b715695

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.0a20230300-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230300-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e5c785c136a67039cb2be561d27ffec9c1dc654c53288f16c43fef2c1644076b
MD5 8adf8f4a2a361cc6169d40d008840182
BLAKE2b-256 0f6963b55ad8335efe0c056072c774d145400283a71edb8bd401b821f9991750

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.0a20230300-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230300-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cdd9ed38b15390dca1435ab51f26d130c52270376bfc042d1a3394c171e0d51d
MD5 c1cdca3322544f3392941cf487e38e9c
BLAKE2b-256 fe6cfbe98c5daf63f926819b77a8343986bcc0189945438ff041cb148fd94e5d

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.0a20230300-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230300-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 16753ec95996a8887500c4b85bb6ac9de465c03b8e2c7c946615b501ee408c63
MD5 44d50967e47adc31a08c057588e253dc
BLAKE2b-256 b14eecf10a2eebd8bbbb1b2d9346295a1afe876a98ff93e66dab28a92a3d960a

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.0a20230300-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230300-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1edaf546df2dc8b9c606b721649788b98df867205384f05e8bddf60c6f86a771
MD5 a90ed9ae94759fe6c6fab2430ce3daa7
BLAKE2b-256 bcdbbe240a0ba6c6e76f4b68322e719112773a01191bd636eca2a614e2cd06b0

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.0a20230300-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230300-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 492899776b96c9a387ae66d9d0aa0db038291f300243039c911ec8f798a9da15
MD5 d8d290f4950985e7ae5b6675a8999baf
BLAKE2b-256 0aad2068f70b63ea1473bf205e02ec227ea66e0c21f4e7cfb485c62beb70c2dc

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.0a20230300-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230300-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 12b428adc5e76518c79273b8037595786fc8e1c40047f199c67bc47303489a82
MD5 1db0d8da42b2b1488469af7361cea803
BLAKE2b-256 f2238c22fc776d2cff09774ddc5df942f18e29ad5c36975e37c93704b4c6d3e7

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-26.0.0a20230300-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-26.0.0a20230300-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2de85e8d9f9c8de976d5528b43721206e469995c021f8690c92e3585447f614b
MD5 b7a922895e18f7cbc9e0da2836e4bd7d
BLAKE2b-256 6b05ba15b7ede1a9ce3461f38ddb56f4f13d756b4ddafad4611609d12e071d8a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page