Skip to main content

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

Project description

← back

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
Windows x64 3.8 · 3.9 · 3.10 · 3.11 · 3.12

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.

Quick start

import geompp as g

# Points & vectors
p = g.Point2D(1.0, 2.0)
v = g.Vector2D(3.0, 0.0)
q = p + v                       # Point2D(4, 2)
diff = q - p                    # Vector2D(3, 0)

# Lines and intersection
l1 = g.Line2D.make(g.Point2D(0,0), g.Point2D(1,0))
l2 = g.Line2D.make(g.Point2D(0.5,-1), g.Point2D(0.5,1))
hit = l1.intersection(l2)       # Point2D(0.5, 0) or None

# 3D
p3 = g.Point3D(1, 2, 3)
plane = g.Plane.xy()
proj = plane.project_onto(p3)   # Point3D(1, 2, 0)

# Precision
g.set_decimal_precision(g.DP_SIX)

# File parser
parser = g.WktParser.open("geometry.lsv")
while parser.has_next():
    item = parser.next()
    if item is not None:
        print(g.WktParser.to_wkt(item))

Checking coplanarity, orientation, and closest world plane

import geompp as g

pts_flat = [g.Point3D(0,0,0), g.Point3D(1,0,0), g.Point3D(0,1,0), g.Point3D(1,1,0)]
pts_3d   = [g.Point3D(0,0,0), g.Point3D(1,0,0), g.Point3D(0,1,0), g.Point3D(0,0,1)]

print(g.are_coplanar(pts_flat))  # True  — all on the XY plane
print(g.are_coplanar(pts_3d))    # False — spans 3D space

# Find which world axis plane is closest to the point cloud
plane = g.closest_world_plane_to(pts_flat)
print(plane.normal)              # Vector3D(0, 0, 1)  → XY plane

# Check / require CCW winding
ring = [g.Point3D(0,0,0), g.Point3D(1,0,0), g.Point3D(1,1,0), g.Point3D(0,1,0)]
print(g.are_ccw(ring))           # True
print(g.are_cw(ring))            # False

# Polygon3D requires CCW outer ring and CW holes
outer = [g.Point3D(0,0,0), g.Point3D(4,0,0), g.Point3D(4,4,0), g.Point3D(0,4,0)]
hole  = [g.Point3D(1,3,0), g.Point3D(3,3,0), g.Point3D(3,1,0), g.Point3D(1,1,0)]
poly  = g.Polygon3D.make(outer, [hole])
print(poly.size())               # 4

Classes

2D 3D
Point2D Point3D
Vector2D Vector3D
Line2D Line3D
Ray2D Ray3D
LineSegment2D LineSegment3D
Polyline2D Polyline3D
Triangle2D Triangle3D
Polygon2D Polygon3D
BBox2D BBox3D
GeometryCollection2D GeometryCollection3D
Plane

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

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

geompp-0.7.0.tar.gz (28.3 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.7.0-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

geompp-0.7.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (5.4 MB view details)

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

geompp-0.7.0-cp311-cp311-win_amd64.whl (2.3 MB view details)

Uploaded CPython 3.11Windows x86-64

geompp-0.7.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.4 MB view details)

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

geompp-0.7.0-cp310-cp310-win_amd64.whl (1.8 MB view details)

Uploaded CPython 3.10Windows x86-64

geompp-0.7.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (3.3 MB view details)

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

geompp-0.7.0-cp39-cp39-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.9Windows x86-64

geompp-0.7.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.2 MB view details)

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

geompp-0.7.0-cp38-cp38-win_amd64.whl (773.7 kB view details)

Uploaded CPython 3.8Windows x86-64

geompp-0.7.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.2 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.7.0.tar.gz.

File metadata

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

File hashes

Hashes for geompp-0.7.0.tar.gz
Algorithm Hash digest
SHA256 10c01eabbde8284a9feed83bfe65a2d294f879710989b1632f3c745a05f45972
MD5 30398c8211d16bd21dab094812551371
BLAKE2b-256 90789eec566874ba28358efcb4f4c4731da1f3837d48e1744fadb9b6f5e8c831

See more details on using hashes here.

File details

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

File metadata

  • Download URL: geompp-0.7.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 2.8 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

Hashes for geompp-0.7.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 88ab469221812a6962bc76b78902fe75bac11296296726e25d4fdd8e0d211793
MD5 ac06a971d311e4b86f16314f584b2a44
BLAKE2b-256 b7c8c178ee08514c2f9fa93aa2e53f5be4bd318c3b792c23a8bcfcb0c27d3eef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geompp-0.7.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 14971eefab74fabd1e67630036886070419a799f653e2ae128e641de021bc368
MD5 3695120d431ba05fa1ee5d0a1a70db48
BLAKE2b-256 74e2e62e0e6bc287f6f02dc2ffaeee1bba8ddb95190285661c7dd837bc5467a6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: geompp-0.7.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 2.3 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

Hashes for geompp-0.7.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 eac1f60a23449415c416ccc9d663271680824ce3fb83aef08440d45fdf204737
MD5 e8b9ba758abaf5bcdc82cd66b5e29616
BLAKE2b-256 500da5db061eaddc897f402fb61f4a48009a1888e46cf97d07cc239be1857a58

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geompp-0.7.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d6f1858ba392da00aef95db63ac36222647e01bf22b4bfabf2e3ad845207fa83
MD5 4ec734a7396f8bd96ba169b641292155
BLAKE2b-256 ae4914b0050acefb052f6d6de1511b2b7d3c9266a920818272afcb5a9f3ac65e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: geompp-0.7.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 1.8 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

Hashes for geompp-0.7.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f9bed4069006cd65d65cb6b4874e302b2245dc68bc43a71a3c55a5832adc0ff3
MD5 22ddee16eb7bbda531aa77c488721323
BLAKE2b-256 303936d7859b15016c48b19a10c91f1071d1d13e62b275c50a6037627bf93038

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geompp-0.7.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 aeeb2777423dd45495cb171a2171559c4a5dd528510616aba79971d45e19851f
MD5 51d177ca792a67f342e0dba611ee1fb2
BLAKE2b-256 c0970e16470924e90ec0ee50ea1cdfa82b78213d482c0fbbe8161f948ea0c0f6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: geompp-0.7.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 1.3 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

Hashes for geompp-0.7.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 c6d5e8ea7722b8737c4e1c90dea3858d739601ae3e4c0fb0abc339a1f6b2e4bd
MD5 00f99f8f523153912e10899451184737
BLAKE2b-256 c38c726b37408b995a4d303643ace84884cf7698536592420186758b517d8448

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geompp-0.7.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f4a076047cd89c34ed0b44ad7cfa4e2dbcee271b86beaa43bf68a3165889b4b7
MD5 03f101f33617a2fe35f8d3eaf4e86d33
BLAKE2b-256 73a2797c95c2065c70163a63d23e298657b9a1a080be8348b767f6387ad38182

See more details on using hashes here.

File details

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

File metadata

  • Download URL: geompp-0.7.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 773.7 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for geompp-0.7.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 ba4c500df5779f7f72ec013441eee76ce0819bcf66c68197f5b70d27223b0c41
MD5 6ded63360a1982f445c9d6a2d2845e1c
BLAKE2b-256 b52ede30c05ad8ef7e73661016f11f4dbc7e38f6a01369e9592881740a7a9e2a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geompp-0.7.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f01532c0b6fc47f4735cb50b268449e899c0544c3ff5fe9c93bf8afea9090c83
MD5 a36c69302f158c091c0da2fc8663dff6
BLAKE2b-256 5c2f5a94e2881eef7aab25f51c4e3418c811b7d8ae92ff22dd092f797cdf86dd

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