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-25.0.0a20224500.tar.gz (129.2 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-25.0.0a20224500-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (659.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

lsst_sphgeom-25.0.0a20224500-cp310-cp310-macosx_11_0_arm64.whl (491.7 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lsst_sphgeom-25.0.0a20224500-cp310-cp310-macosx_10_9_x86_64.whl (513.2 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

lsst_sphgeom-25.0.0a20224500-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (666.6 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

lsst_sphgeom-25.0.0a20224500-cp39-cp39-macosx_11_0_arm64.whl (491.7 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

lsst_sphgeom-25.0.0a20224500-cp39-cp39-macosx_10_9_x86_64.whl (513.3 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

lsst_sphgeom-25.0.0a20224500-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (659.8 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

lsst_sphgeom-25.0.0a20224500-cp38-cp38-macosx_11_0_arm64.whl (491.6 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

lsst_sphgeom-25.0.0a20224500-cp38-cp38-macosx_10_9_x86_64.whl (513.1 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

File details

Details for the file lsst-sphgeom-25.0.0a20224500.tar.gz.

File metadata

  • Download URL: lsst-sphgeom-25.0.0a20224500.tar.gz
  • Upload date:
  • Size: 129.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for lsst-sphgeom-25.0.0a20224500.tar.gz
Algorithm Hash digest
SHA256 f862027c3e516e070b08e0dec5a06bb1e1914f4957cb9d95fa963addf44eca18
MD5 b7f482ec872f5a6c8637470dfaf63657
BLAKE2b-256 9a01b48da95b95bebb544b5174bc40a569ffadf70085e03e38ec0733bd547dd2

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20224500-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224500-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9398a604de69b1cdec8232bc44ef959a577603aef6d831a1ee89404522df656e
MD5 5260a1a2ae82437edd663f72f965ba18
BLAKE2b-256 caa455fd7de7df1455edbfa277c9b43ca28b6d5c412173b198811cbc3c5443ec

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20224500-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224500-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1406283d91d84e19a77ca9564237cf5d09f3103deff1120e810afc5447a8396f
MD5 62706ca3b5627ed282c8bec2c744efc1
BLAKE2b-256 ce10fc30c2a09d512db6ee9581c74e6ec94c06a02b4b0ea1a57fb8550fa77de3

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20224500-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224500-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 526e507e5ff037a88b710cc707e9302cf42ae3de5ffe92600eff2a27bcf27a98
MD5 7f60b4b7945da952798f3b025f1a753b
BLAKE2b-256 90dbdae88fdd92b678bf7529246cec8307966915d4265e5370729d9a8e14da39

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20224500-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224500-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 61b71daecd46f75c2929f9c433fbb154ce33014acc7553478d413b5bbf32eabc
MD5 602088a4e7b1c5440594b4c43415f39e
BLAKE2b-256 794c40783a1526591c1932d79e8dd4cc865ca4161c7a9f558499954cb6724724

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20224500-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224500-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4275312dc86e0f7216411e1a642185e8add4bdb4e99144c6a5224a9fdf8aff17
MD5 c9f96828bb6085075dc5ed34016615fd
BLAKE2b-256 c72551c5d7fa9779160053a58934f2af8074eeec8de1d9adec90a3aa6d8f00cc

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20224500-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224500-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 65b3dbea445336314f9f57d9863342aa31753c745cdd12ab5a76593a506d1db8
MD5 93ddb66f0c2575cc4486ddf5c07bf79a
BLAKE2b-256 3ba148a3a9f9feb0819e7effc308509a969687323e62cb211b854c7e43808441

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20224500-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224500-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2255707f178330a92ab38377621748f93803979b83d52443be430a4f4228551b
MD5 513a95b898cdb0d437250d5a8a48f861
BLAKE2b-256 4edb6a6bf90e09cc64feef85be2879ee1d8c72086d7975681844bb3d0e2fb4bf

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20224500-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224500-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a8cb1e05adfd1c989f3746a8275fbc0f29d5e263e4ef286efd096a0e89df06ca
MD5 dd5f304400121e8ffa13d372cf11a664
BLAKE2b-256 64171f114a7a29f3dda0c951755921356974e09d694329a3de71de59ad21f0e7

See more details on using hashes here.

File details

Details for the file lsst_sphgeom-25.0.0a20224500-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for lsst_sphgeom-25.0.0a20224500-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2eb9595b38009a3295fe1c00eefff13b341dead2ea0ac5de0d26344e87010d1d
MD5 2ee69ea6151ebedd290e3c4e4585205f
BLAKE2b-256 b950fcf017ebf7fa31c9ad48d5e1ff07b9006066b8c4b80efee37b41f52657fa

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