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.

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.15.0.tar.gz (59.4 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.15.0-cp313-cp313-win_amd64.whl (4.8 MB view details)

Uploaded CPython 3.13Windows x86-64

geompp-0.15.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (7.4 MB view details)

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

geompp-0.15.0-cp312-cp312-win_amd64.whl (4.1 MB view details)

Uploaded CPython 3.12Windows x86-64

geompp-0.15.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (6.2 MB view details)

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

geompp-0.15.0-cp311-cp311-win_amd64.whl (3.3 MB view details)

Uploaded CPython 3.11Windows x86-64

geompp-0.15.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (5.0 MB view details)

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

geompp-0.15.0-cp310-cp310-win_amd64.whl (2.6 MB view details)

Uploaded CPython 3.10Windows x86-64

geompp-0.15.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (3.7 MB view details)

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

geompp-0.15.0-cp39-cp39-win_amd64.whl (1.9 MB view details)

Uploaded CPython 3.9Windows x86-64

geompp-0.15.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.5 MB view details)

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

geompp-0.15.0-cp38-cp38-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.8Windows x86-64

geompp-0.15.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.3 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.15.0.tar.gz.

File metadata

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

File hashes

Hashes for geompp-0.15.0.tar.gz
Algorithm Hash digest
SHA256 a0991a712af96e89eb69c0bd79e32a41abd99d1fdfb91ba227a98d82377e1292
MD5 049630ff8d7d53de7ed39e8896b5a2bc
BLAKE2b-256 17f1bef2a4654468c301dff0fd47d0c41dc64f488d059946d473e9f6df082c7f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for geompp-0.15.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ff1ec7aa6a1b50b57258369513dfcd945bd40f5817e7a4f57ebc148f43623c13
MD5 b69757d8d5b541144d0b32445fc23832
BLAKE2b-256 d28cc155828a8157194c3e08fd235f1adc68e4dba5b7895bcdc85c4584b67941

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geompp-0.15.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cbf90e03967d1fe824cd18201619dfb1ffd91cb84a6947803c7680c56e3e89c1
MD5 1d1a2fdb84a463a3b879b3195f421820
BLAKE2b-256 519caa8de8d811ec2215c3b40c476500136e45074b79d5c722e5891bf7864150

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for geompp-0.15.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 82a3819af6a457226cfd7e75b3ac18b334e1500410ed2f3cae358d23a9bee53a
MD5 954a86ed408294898d90e94d103fa5ca
BLAKE2b-256 0c9e0e445a8ebb20915b27249932e53ff63ccedaf444018bbd42de725dc1272b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geompp-0.15.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f4edad87938eaec3e4aed5a8b7381cfdfe9397b9f42a44f9d1599cf101a2c06d
MD5 80a1618bd41c8a85f155373b8df059f4
BLAKE2b-256 e56c1a31c0b3a70b8c772af2f01b5e4608e6da8551a51ac02275c23163e9c872

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for geompp-0.15.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 9680ae882afa1d540fb2c5e1d9343b6967794064577ed3f60ae30dad77746165
MD5 ab12ffea9f9d1926f8aa39bd3b64ffb4
BLAKE2b-256 1a41b98a511db0b634ecb3643db3aff1e7af8428516b7f9d1ab313b645367b71

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geompp-0.15.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a90f3164e8b8efbdb0959673b25b7ff302aa490a153d5a73b3accd8744d8f41e
MD5 c8b445a7de351285affd49d398534b1f
BLAKE2b-256 2dd73e7cb60b3429cd33a28d5fab7bfb9800e69ea54cc637340c1156a70788fd

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for geompp-0.15.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c33297d72961831ed593a515414e8de2922cc02538791300563f3852970aeee3
MD5 f5b20611be4a61ec286e02271d4b9560
BLAKE2b-256 458e61ee2c60e8e063ccb39f5f21b8a614636e0b5cbaae755da4e3185bc51632

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geompp-0.15.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 40ef9fdc64878093967633d25b904495d591a277852903f8a626285b3dbaae13
MD5 30ea5a240b8b8fce28c0e8b20948290b
BLAKE2b-256 0043cd3189ecdd47d287be8a2d74f8559590dc34f249591cce86b89b476b7127

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for geompp-0.15.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f9a441f16df7b05466423b5a4533ab676b80c2ac0e8284ce23997030852b48c6
MD5 d7b20c23c7e6da0a26b194eda3ccb60d
BLAKE2b-256 45f7284d3fe4043ef98fd33d6a7227340aedea637761484bca25e6bc3960b376

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geompp-0.15.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 07a5f9f16d3f34dac427c2f193e5a560036345d3a272614da16c24b6e3581bb5
MD5 ae9dac6544610f4a9dc218e770faea73
BLAKE2b-256 ff8c7c0391c611c63ca7c79b851c94cfdfb9cf0c7e9d075dd82a87ffd3da57a6

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for geompp-0.15.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 bd6ad5814292c7bd766893aafbbc73e81f4513cbf6635000bad53a664959b528
MD5 d23c2125c6171ed1269d28aeb4dfe216
BLAKE2b-256 88592783674657379a865fbe53e4c1f5e6a5e5b3709037159ec930c9714eeaed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geompp-0.15.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4fb6f1adfa38781f8ffc92364c5f37ed26a420404321755ae9fc2b4b59a305eb
MD5 638c27a7f8c09cb23142e8610a310bc6
BLAKE2b-256 17109955b7e859434d981216b57f5042e30c3c9340a289376ae54c06c9b55435

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