Skip to main content

codecov Documentation Status Build Status

A simple Python package for working with geometry related operations. See documentation at gbox.readthedocs.io

Installation

pip install --upgrade gbox

Usage

# create 2D points
from gbox import Point2D
>>> p1 = Point2D(0.0, 0.0)
>>> p2 = Point2D(3.0, 4.0)
>>> p1.distance_to(p2)
5.0

# Create a Cirle with center at point and radius 5.0
>>> from gbox import Circle
>>> c1 = Circle(5.0, p1)
>>> c1.area
78.53981633974483
>>> c1.radius
5.0
>>> c1.position
Shape2DPose(x=0.0, y=0.0, orientation=0.0 rad)
>>> c1.bounding_box
[-5.0, -5.0, 5.0, 5.0]

# Working with Angles
>>> from gbox import Angle
>>> import math
>>> g = Angle(math.pi / 4, "rad")
>>> g
Angle(0.7853981633974483, 'rad')
>>> g.degrees
45.0
>>> g == Angle.deg(45)
True
>>> g.cos
0.7071067811865476

# create a ellipse with cetnere at origin, aspect ratio 2 and orientation 45 degrees
>>> import gbox as gb
>>> e = gb.Ellipse(2, 1, major_axis_angle=gb.Angle.deg(45))
>>> e.area
6.283185307179586
>>> e.perimeter
9.688448220547677
>>> e.position
Shape2DPose(x=0.0, y=0.0, orientation=45 deg)
# check point outside the ellipse
>>> e.contains_point((10, 10))
-1
# check point inside the ellipse
>>> e.contains_point((1, 1))
1
# check point on the ellipse
>>> e.contains_point(gb.transform_point_2d(2, 0, angle=gb.Angle.deg(45)))
0  

For Developers

Install dependencies

Setup environment using uv

# clone the repo, if not done yet
git clone https://github.com/gbox/gbox.git  

# install the uv, if not available, from [uv](https://docs.astral.sh/uv/)

# From the repo root do the following to install the venv
uv sync

Metadata

Release files for gbox 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gbox 1.3.0
File Size Uploaded Provenance Actions
gbox-1.3.0.tar.gz 41.2 kB Without provenance Details for gbox-1.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gbox 1.3.0
File Interpreter ABI Platform Actions
gbox-1.3.0-py3-none-any.whl Python 3 none any Details for gbox-1.3.0-py3-none-any.whl

Total release size: 85.8 kB

Release files / gbox-1.3.0.tar.gz

Download URL gbox-1.3.0.tar.gz
Size 41.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2e5d5a19a9cfc4d507f04de33fe915f8d066dbb347d5626d62b792730549b8e9
BLAKE2b-256 checksum
How to use checksums
917a0533029ae161d139696731044b4803cc14c1bf2a7f72328d9a498dfc1f5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / gbox-1.3.0-py3-none-any.whl

Download URL gbox-1.3.0-py3-none-any.whl
Size 44.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b5af38935d236890772da278d1d93d2ab7e17358ad694cbc3a36b296e7cc3f11
BLAKE2b-256 checksum
How to use checksums
5707a5200a0a504afb7ec2e715d3888fb050247595cfca90f48aec1b20c22e1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for gbox 1.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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