Python bindings for geompp — a C++ 2D/3D geometry library
Project description
geompp
Python bindings for geompp — a C++ 2D/3D geometry library.
Changelog — full release notes for every version.
Install
pip install geompp
Pre-built wheels are available for:
| Platform | Python versions |
|---|---|
| Linux x86_64 | 3.8 · 3.9 · 3.10 · 3.11 · 3.12 · 3.13 · 3.14 |
| Windows x64 | 3.8 · 3.9 · 3.10 · 3.11 · 3.12 · 3.13 · 3.14 |
If your platform or Python version is not in the table above, pip will compile from source — you will need CMake ≥ 3.15 and a C++20-capable compiler.
How to use it
You can look at the test suite to see detailed usage. There also is a whole set of code examples in the next page.
Classes
| 2D | 3D |
|---|---|
| Point2D | Point3D |
| Vector2D | Vector3D |
| Line2D | Line3D |
| Ray2D | Ray3D |
| LineSegment2D | LineSegment3D |
| Polyline2D | Polyline3D |
| Triangle2D | Triangle3D |
| Polygon2D | Polygon3D |
| BBox2D | BBox3D |
| BBall2D | BBall3D |
| BRect2D | |
| BPrism3D | |
| GeometryCollection2D | GeometryCollection3D |
| Plane | |
| View2D |
Free functions
| Function | Description |
|---|---|
are_collinear(p1, p2, p3) |
Three points on the same line |
are_coplanar(points) |
List of Point3D on the same plane |
closest_world_plane_to(points) |
XY / YZ / ZX plane nearest to the point cloud |
are_ccw(points[, ref_plane]) |
Counter-clockwise winding (2D or 3D) |
are_cw(points[, ref_plane]) |
Clockwise winding (2D or 3D) |
remove_collinear(points) |
Drop collinear intermediate points |
remove_duplicates(points) |
Drop duplicate points |
average(points) |
Arithmetic mean |
linear_combination(points, weights) |
Weighted sum |
has_intersections(segments) |
Shamos–Hoey: True if any two segments in list[LineSegment2D] cross |
find_intersections(segments) |
Bentley–Ottmann: returns list[Point2D] — every crossing point, sorted left-to-right |
convex_hull(points) |
Andrew's monotone chain: convex hull of a list[Point2D], returned in CCW order |
convex_hull(points, normal=None) |
Convex hull of a coplanar list[Point3D]; optional Vector3D normal (auto-detected if omitted) |
principal_axes(points) |
PCA on a list[Point3D]: returns CoordinateFrame (.x primary, .y secondary, .z best-fit normal) |
principal_normal(points) |
Best-fit plane normal of a list[Point3D] (PCA eigenvector with smallest eigenvalue) |
principal_direction(points) |
Dominant direction of a list[Point3D] (PCA eigenvector with largest eigenvalue) |
Planar operations
View2D projects 3D points into 2D coordinates via .x(point) / .y(point). It is particularly
useful for streaming large containers of Point3D without allocating an intermediate list of
Point2D — each call reads one or two scalar coordinates directly.
from geompp import View2D, ProjectionType, Plane, Point3D, Vector3D
# axis-aligned views (fastest path)
v_xy = View2D.xy() # x→x, y→y (drops z)
v_yz = View2D.yz() # y→x, z→y (drops x)
v_zx = View2D.zx() # z→x, x→y (drops y)
# custom view onto any plane
plane = Plane.from_origin_and_normal(Point3D(0, 0, 5), Vector3D(0, 0, 1))
v_custom = View2D.on_plane(plane)
pts3d = [Point3D(1, 2, 5), Point3D(3, 4, 5), Point3D(5, 6, 5)]
# stream 3D points to 2D without building a Point2D list
xs = [v_xy.x(p) for p in pts3d] # [1.0, 3.0, 5.0]
ys = [v_xy.y(p) for p in pts3d] # [2.0, 4.0, 6.0]
print(v_xy.type) # ProjectionType.XY
Bounding containers
BRect2D — minimum oriented bounding rectangle (rotating calipers; requires ≥ 3 non-collinear points):
import geompp
pts = [geompp.Point2D(0, 0), geompp.Point2D(4, 0), geompp.Point2D(4, 3),
geompp.Point2D(2, 4), geompp.Point2D(0, 3)]
rect = geompp.BRect2D(pts)
print(rect.center) # Point2D(2.0, 1.75)
print(rect.axis_u, rect.axis_v) # unit vectors along the OBB edges
print(rect.width, rect.height)
print(rect.area)
corners = rect.corners() # list of 4 Point2D
print(rect.contains(geompp.Point2D(2, 1))) # True
BPrism3D — minimum oriented bounding prism (PCA + rotating calipers; requires ≥ 3 non-collinear points):
import geompp
pts = [
geompp.Point3D(0, 0, 0), geompp.Point3D(4, 0, 0),
geompp.Point3D(4, 3, 0), geompp.Point3D(0, 3, 0),
geompp.Point3D(0, 0, 2), geompp.Point3D(4, 0, 2),
geompp.Point3D(4, 3, 2), geompp.Point3D(0, 3, 2),
]
prism = geompp.BPrism3D(pts)
print(prism.center) # roughly Point3D(2, 1.5, 1)
print(prism.axis_u, prism.axis_v, prism.axis_w) # orthonormal frame
print(prism.width, prism.height, prism.depth) # 4.0, 3.0, 2.0
print(prism.volume) # ~24.0
corners = prism.corners() # list of 8 Point3D
print(prism.contains(geompp.Point3D(2, 1.5, 1))) # True
print(prism.almost_equals(geompp.BPrism3D(pts))) # True
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file geompp-0.11.0.tar.gz.
File metadata
- Download URL: geompp-0.11.0.tar.gz
- Upload date:
- Size: 47.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e2f0cd4c041e2fc4c24ec11da2c583632f238bd0be0445f8dd5fd3d43c1e542
|
|
| MD5 |
10b47323842687dea7f184584617c2dd
|
|
| BLAKE2b-256 |
b63d82cfec152a7ffca6c1e8c3bde4535bfda7684daa3323f29f21dd18b91099
|
File details
Details for the file geompp-0.11.0-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: geompp-0.11.0-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 4.0 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8aa3f38ab30ef01262d6941f15bd89ea2f91d98496385d8a20c58896fa74e1ce
|
|
| MD5 |
dd7cdb3984a467093d8d89b106642609
|
|
| BLAKE2b-256 |
1e9d1848d18a3a767ce36e817f825e17f7e1116be8ec7a90b7214615156e1de3
|
File details
Details for the file geompp-0.11.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: geompp-0.11.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 6.2 MB
- Tags: CPython 3.13, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b4c10d151531ad9ba1d4c3bea8a5cbaec4bf458d80ebde7abb1498c446d6c9f
|
|
| MD5 |
06ce08efafd8c5d754db724fc0607852
|
|
| BLAKE2b-256 |
7540016fe46e78936d09d4827cbefe5956b76d1f1a3fcfbd89d90b8ecc99c632
|
File details
Details for the file geompp-0.11.0-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: geompp-0.11.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 3.4 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32bd4409007e3de70a177beec1f22d18266db82a1950273eb632de20062d7d6b
|
|
| MD5 |
81d694f990e8c62fb822d544e4851766
|
|
| BLAKE2b-256 |
1dcaa9f4e8bc5cced5817d42287ec0176e40a8af13bf8023c8f1491061324fa1
|
File details
Details for the file geompp-0.11.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: geompp-0.11.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 5.2 MB
- Tags: CPython 3.12, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2cac09b24a3ce867d0e4cc32d058b1a7f5d1316aace80c004c189cc042f3d4c0
|
|
| MD5 |
d604f2d35b43e21dc25241070954aa26
|
|
| BLAKE2b-256 |
33dfb295905572363fc07372297f251608b6013710caf8ce05255fe22209d6fe
|
File details
Details for the file geompp-0.11.0-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: geompp-0.11.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07878c5582dadf875cc9df70d649256e04f716cb0a746349352422de25a43042
|
|
| MD5 |
730ee0b89616849c4dff07cb01913d97
|
|
| BLAKE2b-256 |
a173ad4efcdd4837e84bab6bd6e54e2cf51b9ead4d68d268c3678a68a14c760d
|
File details
Details for the file geompp-0.11.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: geompp-0.11.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 4.2 MB
- Tags: CPython 3.11, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee5bae213607637e7ca5bc7275a5c833a057b0d712e83ddef87eb033a513a121
|
|
| MD5 |
ebdde9540e6a9e6240c4a31b30f0bd5e
|
|
| BLAKE2b-256 |
a9d21928edafe92541c493d56e1d2a764f7b0a771ee3c4444492fda4ccad74e3
|
File details
Details for the file geompp-0.11.0-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: geompp-0.11.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01f7e16638cc984595bec12472af8ae4b0f7c31ff6cf700b607e48bd6ce26aa2
|
|
| MD5 |
486b01448549445202c64a36221a5976
|
|
| BLAKE2b-256 |
8a6a17e446351965bda723da34f9986578bb3cd8e868a0a4433a58fc9a6d9e5d
|
File details
Details for the file geompp-0.11.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: geompp-0.11.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.10, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
881fbc92821854b610a6b67b1fbd47ac62b56b7b1addcfb2b2df322d6c8cd041
|
|
| MD5 |
bdbfd1dc52a13a5ce6d3bcfacc182fe9
|
|
| BLAKE2b-256 |
67e0ae817c483b519febefeb4a2b1684e7b51ee7e305d0cb19592011b14e5217
|
File details
Details for the file geompp-0.11.0-cp39-cp39-win_amd64.whl.
File metadata
- Download URL: geompp-0.11.0-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d876391a7d749449d1a86365152fad2e4053f67a4b8bb28f256cb3a380a69b04
|
|
| MD5 |
d8d551cce8e28a0c14d1ada5c54d05bc
|
|
| BLAKE2b-256 |
e45f2c12e8c0a96f0cdfeaf331a310d0d4af8ed72619d5613a44b5ba4e12a124
|
File details
Details for the file geompp-0.11.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: geompp-0.11.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.9, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26bc7820e3873ec8ffc5c61f789a0c04e7f0bbcc80ad21db5cf9025a983b60f3
|
|
| MD5 |
5c5fa2c91f4bae8760b1e72e205f8a80
|
|
| BLAKE2b-256 |
d6dd33b3f723b4c4371dcc9ef5b2ed79fe9410682375c4b950b6a815e4e413d1
|
File details
Details for the file geompp-0.11.0-cp38-cp38-win_amd64.whl.
File metadata
- Download URL: geompp-0.11.0-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee310a2c35b678da4430a6756b1a1229f24d6195b4391ad441a28c5632b38dcc
|
|
| MD5 |
b53e686898fa91ddd3adbc1fe3ffef8a
|
|
| BLAKE2b-256 |
38e833f73faadfde83959e230b40dd84cdf652835bab8b4c05d03f5353335270
|
File details
Details for the file geompp-0.11.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: geompp-0.11.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.8, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
816beb9fe9159fa65b36b04d1b3e7e0310c8c4182d75166b09722dbf2aa06186
|
|
| MD5 |
a0df2c8ef84bd9d6630d252b862a2150
|
|
| BLAKE2b-256 |
31a7dc30b9365bb7c5eebfafbc72c475127985d0f278b01a249d88433ae1ba17
|