Skip to main content

geoclide


pypi conda-forge github downloads

tests docs license pixi ruff

A python package for geometric calculations in the three-dimensional Euclidean space

Mustapha Moulana
HYGEOS website
Documentation


Features

  • Basic geometric objects: vectors, points, normals, rays and bounding boxes
  • Geometric transformations: translations, scales and rotations
  • Ray intersection tests with shapes: spheres, spheroids, disks, triangles and triangle meshes
  • Vectorized calculations with numpy: sets of objects and/or sets of rays can be processed at once
  • Intersection results returned as xarray datasets, gathering the intersection information and the shape attributes
  • Visualization of the quadrics and triangle meshes, and reading/writing of triangle meshes (netcdf4, and formats supported by trimesh as stl, ply, ...)

Installation

The installation can be performed using one of the following commands:

$ conda install -c conda-forge geoclide
$ pip install geoclide
$ pip install git+https://github.com/hygeos/geoclide.git

Quickstart

Perform an intersection test between a ray and a sphere, and get the intersection information as an xarray dataset:

>>> import geoclide as gc
>>> sphere = gc.Sphere(radius=1.)
>>> ray = gc.Ray(o=gc.Point(-2., 0., 0.8), d=gc.Vector(1., 0., 0.))
>>> ds = gc.calc_intersection(sphere, ray)
>>> ds['thit'].values, ds['phit'].values
(array(1.4), array([-0.6,  0. ,  0.8]))

Create a triangle mesh, place it in the scene with a transformation, then intersect it with the same ray:

>>> import numpy as np
>>> vertices = np.array([[-5., -5., 0.], [5., -5., 0.],
...                      [-5., 5., 0.], [5., 5., 0.]])
>>> faces = np.array([[0, 1, 2], [2, 3, 1]])
>>> translate = gc.get_translate_tf(gc.Vector(2.5, 0., 0.))
>>> rotate = gc.get_rotate_y_tf(-90.)
>>> mesh = gc.TriangleMesh(vertices, faces, otw=translate*rotate)
>>> ds = gc.calc_intersection(mesh, ray)
>>> ds['is_intersection'].values, ds['thit'].values
(array(True), array(4.5))
>>> ds['phit'].values
array([2.5, 0. , 0.8])

Documentation

The complete documentation is available at hygeos.github.io/geoclide. It includes example notebooks (basics, remote sensing applications, quadrics visualization and numpy acceleration) and the full API reference. The docstrings are also available from the built-in help function, e.g. help(gc.calc_intersection).

License

Geoclide is licensed under the Apache License 2.0, see LICENSE.txt.

Download files

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

Source Distribution

geoclide-4.0.0.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

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

geoclide-4.0.0-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

Details for the file geoclide-4.0.0.tar.gz.

File metadata

  • Download URL: geoclide-4.0.0.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for geoclide-4.0.0.tar.gz
Algorithm Hash digest
SHA256 5454fc8149e271d44eb57dd93e1342e88185021c15e5b8d6cd334e97df4bbb07
MD5 2fc6bdf2121af7cf3bd38715ba5ad5f2
BLAKE2b-256 131ac8b4a7b83eefd38096646122795efd4c246c641f881cfba25c8774f37896

See more details on using hashes here.

Provenance

The following attestation bundles were made for geoclide-4.0.0.tar.gz:

Publisher: push_pypi.yml on hygeos/geoclide

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file geoclide-4.0.0-py3-none-any.whl.

File metadata

  • Download URL: geoclide-4.0.0-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for geoclide-4.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb310728c173d282a55226e0919302ea5b46311ea7ced06208507f824913ac39
MD5 fd878135e4e48321512905f6adcc07fa
BLAKE2b-256 bcb0bdc53c61fb81d20236f04b623cda306f375c6eedbffcb5ca2f2cf25d8fd8

See more details on using hashes here.

Provenance

The following attestation bundles were made for geoclide-4.0.0-py3-none-any.whl:

Publisher: push_pypi.yml on hygeos/geoclide

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

4.0.0 This release

2 files

3.0.3

2 files

3.0.2

2 files

3.0.1

2 files

3.0.0

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

1.2.2

2 files

1.2.1

2 files

1.2.0

2 files

1.1.1

2 files

1.1.0

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page