Skip to main content

GeomPP — Python Bindings

Python bindings for geompp — a C++ 2D/3D geometry library.

Changelog — full release notes for every version.

Install

pip install geompp

Platform note

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.

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

Algorithm overview

Each class supports a consistent set of spatial operations where applicable:

  • Containment — does a shape contain a given point?
  • Intersection — do two shapes strike through each other, and what is the resulting geometry? Also available as the free function find_intersections() on a free set of segments. The meaning of this operation changes from 2D to 3D — check the class docs.
  • Overlap — do two shapes have a portion in common, and what is the resulting geometry? Meaning changes from 2D to 3D.
  • Touch — do two shapes have a point in common, and which is it? Meaning changes from 2D to 3D.
  • Distance — closest distance from a point to a shape.
  • Plane operations — projection of a point from 3D to 2D, and re-projection from 2D to 3D, via the Plane class or the faster View2D (one of the 3 world planes XY/YZ/ZX, or a custom plane).
  • Interpolation / Locationlerp(p0, p1, t) retrieves a point at parameter t between two points (not clamped); interpolate(t) does the same along a segment or polyline; the opposite operation finds the parameter t for a point already on a shape.
  • Area / Perimeter / Centroid — geometric properties for closed shapes.
  • Signed area — encodes orientation (clockwise vs. counter-clockwise in 2D, surface normal direction in 3D).
  • Simplicity / self-intersectionPolygon2D.is_simple() and the free functions has_intersections(segments) (Shamos–Hoey, boolean) / find_intersections(segments) (Bentley–Ottmann, every crossing point).
  • Convex hullconvex_hull(points) — Andrew's monotone chain, returns hull vertices in CCW order.
  • Bounding containers — tight-fitting containers around point clouds: axis-aligned bounding box, bounding ball, minimal oriented rectangle, convex hull.
  • Polyline operationsPolyline.reduce() (decimation) and Polyline.expand() (Bezier corner smoothing), or the underlying free functions (dist_decimation()/rdp_decimation()/vw_decimation(), bezier_smoothing_2(), polyline_expansion()) for a plain point list.
  • Polygon boolean operationsintersection(), union(), difference(), xor() between two polygons (map-overlay method), or the free function clip(clipper_loop, subject_loop) for raw point loops without constructing a Polygon first.
  • Point cloud operationsprincipal_axes() (PCA) finds the empirical 3 directive axes of a list of points in space.

Return values are None on no-intersection, and sometimes a Point/list[LineSegment]/list[Polygon] depending on what the operation produced — check each method's docstring for the exact shape.

Free functions

Function Description
are_collinear(p1, p2, p3) Three points on the same line
remove_consecutive_duplicates(points) Drop consecutive duplicate points
remove_duplicates(points) Drop duplicate points
remove_collinear(points) Drop collinear intermediate points
linear_combination(points, weights) Weighted sum
average(points) Arithmetic mean
lerp(p0, p1, t) Linear interpolation between two points — P0 + t*(P1-P0), not clamped
centroid(points[, plane]) Centroid of a polygon (3D: plane auto-detected if omitted)
signed_area(points[, plane]) Signed area of a polygon; positive = CCW, negative = CW
are_ccw(points[, ref_plane]) Counter-clockwise winding (2D or 3D)
are_cw(points[, ref_plane]) Clockwise winding (2D or 3D)
are_coplanar(points) List of Point3D on the same plane
closest_world_plane_to(points) XY / YZ / ZX plane nearest to the point cloud
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)
clip(clipper_loop, subject_loop) Set intersection of two point loops — list[Point2D] natively, list[Point3D] if coplanar (same map-overlay engine as Polygon.intersection())
dist_decimation(points, threshold) O(n) radial-distance point decimation
rdp_decimation(points, threshold) Ramer–Douglas–Peucker point decimation
vw_decimation(points, threshold) Visvalingam–Whyatt point decimation
bezier_smoothing_2(p0, p1, p2, smoothness, min_distance|num_segments, min_segment_length=...) Rounds one polyline corner with a quadratic Bezier arc
polyline_expansion(points, settings) Rounds every inner corner of a point list and works with either fixed number of segmens or fixed min segment length (the engine behind Polyline.expand())
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)
find_extreme_points(polygon, line) The two polygon vertices least/greatest projected along a line's direction
distance_to(polygon, line) Distance from a polygon to a line (zero if they intersect)
tangents_to(polygon, point_or_polygon) PolygonTangents2D/PolygonTangents3D (.left/.right) — tangent segments to a point, or common outer tangents to another polygon

Serialization

All primitives support:

  • WKT (Well-Known Text) — to_wkt() / from_wkt() for standard text interchange
  • Binary file I/Oto_file() / from_file() for compact storage

Precision

Floating-point comparisons use a thread-local DECIMAL_PRECISION constant via AlmostEquals() methods, making the library robust against rounding errors while remaining configurable per thread.

Test Coverage

This is the summary of the current test coverage. More on test coverage.

Metric Count Notes
Public methods (C++) ~491 Excl. ctors/dtors/operators
C++ methods tested ~469/491 ~95% (909 TEST cases, 907 run, 2 disabled)
Python methods tested 423/443 ~95% (742 pytest cases)
C# methods tested 482/549 ~88% (846 harness tests)
Stubs (not yet impl.) 0 Previously 10 — all now implemented (see test_coverage_report.md)

How to use it

You can look at the test suite to see detailed usage.

A quick list of code examples per topic is provided here.

👉 Visual Documentation and Code Examples on Github

Download files

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

Source Distribution

geompp-0.16.0.tar.gz (79.9 kB view details)

Uploaded Source

Built Distributions

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

geompp-0.16.0-cp313-cp313-win_amd64.whl (5.4 MB view details)

Uploaded CPython 3.13Windows x86-64

geompp-0.16.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (8.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

geompp-0.16.0-cp312-cp312-win_amd64.whl (4.6 MB view details)

Uploaded CPython 3.12Windows x86-64

geompp-0.16.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (7.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

geompp-0.16.0-cp311-cp311-win_amd64.whl (3.8 MB view details)

Uploaded CPython 3.11Windows x86-64

geompp-0.16.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (5.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

geompp-0.16.0-cp310-cp310-win_amd64.whl (2.9 MB view details)

Uploaded CPython 3.10Windows x86-64

geompp-0.16.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

geompp-0.16.0-cp39-cp39-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.9Windows x86-64

geompp-0.16.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

geompp-0.16.0-cp38-cp38-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.8Windows x86-64

geompp-0.16.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

File details

Details for the file geompp-0.16.0.tar.gz.

File metadata

  • Download URL: geompp-0.16.0.tar.gz
  • Upload date:
  • Size: 79.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for geompp-0.16.0.tar.gz
Algorithm Hash digest
SHA256 ef426a2d13aba7840ed7d69f815df1db5da222260662529d7d6e3832b2ea490e
MD5 ddea8db925ebeb3927b33530714dd34a
BLAKE2b-256 d07b3c1b9fb9e72564fc0b9f7a7269dd377596e020d40963a33a68429aa7da02

See more details on using hashes here.

File details

Details for the file geompp-0.16.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: geompp-0.16.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 5.4 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for geompp-0.16.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 69041eecfedd19ab11c136a8eb1431a84669369e8a3ba2b6e97218d56bbb1fde
MD5 14eab6c2c3ea54248e60619e284af3a0
BLAKE2b-256 a52ad7c2d2e9b7b8bb2dd14792a78f5eb0705eef8fad92fc1eec506b1803cada

See more details on using hashes here.

File details

Details for the file geompp-0.16.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for geompp-0.16.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cc4cbc6588dc2b65d5d37f60cc54b7491beb71ca9ee62034eaea1141b2b9b13a
MD5 fe6faa46cbc3a1234db17302946196d3
BLAKE2b-256 f658fd44f37fa34c6a1d1bc6eb09c873fa64e636c9a53d7c58b9c9852a138c5f

See more details on using hashes here.

File details

Details for the file geompp-0.16.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: geompp-0.16.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 4.6 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for geompp-0.16.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 90bf1d6e4ad61f644b19517bb9f38db13478fb998ba21df4b6f307c343a67ffa
MD5 b24e1db6c44a0857c02aaaab83b36cbf
BLAKE2b-256 10e11a42d25c18c00d5c5e12c3bc9088b80e3c956571d39f4893451f4fb4d59a

See more details on using hashes here.

File details

Details for the file geompp-0.16.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for geompp-0.16.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3fb757c6a403242cea2429cbbfa36fa5c03f992e75815f4c71107aadb8572efc
MD5 a7f8003e452130db74710d4a45e4ced5
BLAKE2b-256 bba84d43bdc80107d0de2e838b5c6fef1ecdde9caa575b4c5606d66bd1a679dc

See more details on using hashes here.

File details

Details for the file geompp-0.16.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: geompp-0.16.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 3.8 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for geompp-0.16.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6e7732afb9b4201b40610afa1c509dd685ad30cfc6e062ea8e37c6a3e72e5f62
MD5 6403df8b8909ac08543fb7a66375b600
BLAKE2b-256 19e542727820b3de46f5a393560af48329c2bd3b15adcb59fdae93ed506e0410

See more details on using hashes here.

File details

Details for the file geompp-0.16.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for geompp-0.16.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7e09c8031d32e771c9062bedcb5bdc11f55b16e67e0c14ae4e38d931207d51b8
MD5 4f3ff11d6f07db94a128087893f4f399
BLAKE2b-256 016ab011ef9697260acf03a436f66c95a21f019e39a994f1da77a1aa79631f4a

See more details on using hashes here.

File details

Details for the file geompp-0.16.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: geompp-0.16.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 2.9 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for geompp-0.16.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 12de4a17bce95d9ba6228d4408b69e77755ad567c28909808eb5ecac820d68e6
MD5 f37afc86808c1592d74913f84010e7a4
BLAKE2b-256 10d2df087a609336ed25732df71b692f4290aefeaa0305f8d0098cfbae599b3e

See more details on using hashes here.

File details

Details for the file geompp-0.16.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for geompp-0.16.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f910efb752fa0f8d02f5f7008ae97a9aa51b8d8ead08e9d7e880846af9869273
MD5 8f485965682c6937f6b226b3e23a2edf
BLAKE2b-256 698534d0dfb7d65d8107436dd3b4ec60d684c74379a907281d51bb629232cb52

See more details on using hashes here.

File details

Details for the file geompp-0.16.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: geompp-0.16.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for geompp-0.16.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 2950d101bf671123d9dcb62075a9679071ccb00477f69ac82deb6fa4b2094ae1
MD5 b14ad21452708339e05f1b065cd312c2
BLAKE2b-256 3c5524a8dce2ab7e2e0f4fee7684c752c3a161945c19a84db9919d352c891bd1

See more details on using hashes here.

File details

Details for the file geompp-0.16.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for geompp-0.16.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a45e4cec67f1e9845ee2238ced8fd561e677a38d9ca7faa0f6de8bca11fd6298
MD5 6400558d4ad6f3a4e762a7faf3b1a830
BLAKE2b-256 0e083cf3661560ff5d2ce5c9910fa6ec08fbb4d43ce23da1a7beb2d01191ae40

See more details on using hashes here.

File details

Details for the file geompp-0.16.0-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: geompp-0.16.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for geompp-0.16.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 5be7cadf7ed4874dd2279d998397c99ef1883e0694b92fdf26eb493ce67c57f0
MD5 83c38d84052a6cef4a9bb34c3ff149c4
BLAKE2b-256 628f715f2015090b3971b1960cc88b7c06024aa9744b330b6e5ba0484eae6976

See more details on using hashes here.

File details

Details for the file geompp-0.16.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for geompp-0.16.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b6f2962946213a1ab986d55a3e7d18b7d604fc39a3561461eae4ba9be2c325cc
MD5 9cb1905e719925f4cd3b79823e038d58
BLAKE2b-256 f4fbe1e658bbbda0a3fa03870dd6bf9fd5d20a69da30d5bebf70d4f54b1a264e

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 Sentry Error logging StatusPage Status page