Skip to main content

2D and 3D geometry in Python.

Project description

KilleenGeo

Downloads GitHub release PyPI Documentation Status Code style: black

2D and 3D geometry in Python. This library was originally a part of the DeepDRR package, but has been split out into its own package for easier use in other projects. It contains a lot of custom implementations with no overarching design philosophy, other than getting me through my PhD.

The naming conventions and general approach to coordinate transforms adheres to this tutorial.

It is written solely in Python, and so is not particularly fast. It is also not particularly well-tested, so use at your own risk.

Installation

pip install killeengeo

Usage

import killeengeo as kg

# Define some points in a world coordinate frame
a = kg.point(1, 2, 3) # a point in 3D
b = kg.point(4, 5, 6) # another point in 3D
v = kg.vector(7, 8, 9) # vector
l = kg.line(a, b) # line connecting a and b
pl = kg.plane(a, v) # plane containing a, b, and normal v
# Also supported: line segments, rays

# Define some coordinate frames
world_from_A = kg.FrameTransform.from_translation(a) # coordinate frame with origin at a 
world_from_B = kg.FrameTransform.from_translation(b) # coordinate frame with origin at b

# Transforms to obtain points in those frames
B_from_world = world_from_B.inverse() # transform from B to world
A_from_world = world_from_A.inverse() # transform to A from world

# Transform between the new frames
A_from_B = A_from_world @ world_from_B # transform to B from A

# Objects in the new frame
a_in_A = A_from_world @ a
v_in_A = A_from_world @ v
l_in_A = A_from_world @ l
pl_in_A = A_from_world @ pl

Most of the time kg objects can be treated like numpy arrays, and they are converted to the expected form.

import numpy as np

points = np.array([a, b]) # [2, 3] array where each row is a point
B2A = np.array(A_from_B) # [4, 4] array representing the transform from B to A

Above is the only use of the X2Y naming convention for frame transformations present here. For more information on why this variable naming convention is awful, see this tutorial.

Documentation

Documentation is (maybe) available at killeengeo.readthedocs.io.

Project details


Download files

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

Source Distribution

binigogeo-0.0.5.tar.gz (32.8 kB view details)

Uploaded Source

Built Distribution

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

binigogeo-0.0.5-py3-none-any.whl (35.1 kB view details)

Uploaded Python 3

File details

Details for the file binigogeo-0.0.5.tar.gz.

File metadata

  • Download URL: binigogeo-0.0.5.tar.gz
  • Upload date:
  • Size: 32.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.10

File hashes

Hashes for binigogeo-0.0.5.tar.gz
Algorithm Hash digest
SHA256 d82ad9255b8345b00ead855025a4714d1bfae2676b5d5043d5a7ff1ce0b18fe6
MD5 c5df76854ae2d948decdd51a0bbbf3df
BLAKE2b-256 962f59f5e7765ed41aa1bab5bbc124c1656e1f5334fa036d8a1742ed989acc2b

See more details on using hashes here.

File details

Details for the file binigogeo-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: binigogeo-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 35.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.10

File hashes

Hashes for binigogeo-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a9d808e0416aac51dce1d0e8a14acf1d13daaf3863c59c74cf36a140d6001a62
MD5 e12693886250921d9ef5144c3a599b00
BLAKE2b-256 9a5e3895db5e636008f967277c1d4fcd646e2d5ca6bba9263646b4a6138c1423

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