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.

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.6.0.tar.gz (22.2 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.6.0-cp312-cp312-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.12Windows x86-64

geompp-0.6.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.6.0-cp311-cp311-win_amd64.whl (2.3 MB view details)

Uploaded CPython 3.11Windows x86-64

geompp-0.6.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.6.0-cp310-cp310-win_amd64.whl (1.8 MB view details)

Uploaded CPython 3.10Windows x86-64

geompp-0.6.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.6.0-cp39-cp39-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.9Windows x86-64

geompp-0.6.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.6.0-cp38-cp38-win_amd64.whl (771.4 kB view details)

Uploaded CPython 3.8Windows x86-64

geompp-0.6.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.6.0.tar.gz.

File metadata

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

File hashes

Hashes for geompp-0.6.0.tar.gz
Algorithm Hash digest
SHA256 32e0354e594de085bfc0284f29ce876cffd1d7ea271143df45af0e72378e16f1
MD5 2fa835eb0bc6bfffdac857066e61ceb5
BLAKE2b-256 0b42eea42fec45b51db451f3b21da94f8add9cd4c4bb4bb9689e0c466b4bf5fd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: geompp-0.6.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.6.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4aaf3fe619ce5b31ad57d4ce55ebe843ec4b3cdd830e081a415c39cf7b572526
MD5 9c3b87a4cf8f526a4088272baccb8eff
BLAKE2b-256 6d21334c81e7da0367d7762d315770dba38460ebb98689612dbf6e55b40fff40

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geompp-0.6.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e3ed64c169b4a5e0d837feb7896a42f7c1d8cafed43562cfb80bfb2340140ce6
MD5 f2fa0a628a2e66a56a986dae090aef57
BLAKE2b-256 2648ce83f22b803c172854d25c1b9a8da987ebe88928927111bda322212a9fa1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: geompp-0.6.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.6.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ef04a8faf82e4f0398842ae7f5d9ef0798ad6fcac165f715c30ec6b1fdf5cb9b
MD5 07965b4d7892806bd30d5c10a3c0c76c
BLAKE2b-256 3e7cfe8330e56f7ebc747486c53f9747d0434e4abfcaec7918bd9537e68d08b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geompp-0.6.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bd8b4a09e862d0642ac57f0a2975f46b5726969ff49e5685c981f84b980f5d08
MD5 f02c317e3daaf2ceaf11c772a8111120
BLAKE2b-256 ad3d7872d16f5ed201069bb8d9fef777d6c2f904827612d695da480137e26aac

See more details on using hashes here.

File details

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

File metadata

  • Download URL: geompp-0.6.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.6.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1b5590c8d2089e2c6cac2874d0e07a6d19c1babe819ddb86e5b5a4848fe20704
MD5 1d291ed935d420da8d4efdef8507d005
BLAKE2b-256 e1b3a185ad71c58b73e1ab6a56cc8fd26f9c9f0536b7f90300e1a7dc9cb1d990

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geompp-0.6.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b05b774ba1ecbfac889c659048f658117e02c1b95b8a70873417dec14dbb561c
MD5 a2746e39c2adbc2460a2265d09edb597
BLAKE2b-256 e7fe29fa1ea6a886d932ad2d677b2d0d31291880209ad1baee6a1e5f086253f5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: geompp-0.6.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.6.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 3d594aac1da938c2c294d59fe24825c411794c2ac64a23b291ce84f6b5ee0025
MD5 7af5b406f4d29010efc9df3655efd4c5
BLAKE2b-256 5a0f0f0fb02a5a2ce1826f785836c6ae34e9a4c0ebcc715fc56fe3ae3b0d8628

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geompp-0.6.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bd0229a71cae93b0284eadd63ccb5a910a9e448f4c2c32799b350c1489639f12
MD5 d7f7a3e92353fcfb80f7308903c6d3af
BLAKE2b-256 7698b7cf512a84c6fe7c15cffb9c845f434066b9b29b311c01892fec26c621bf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: geompp-0.6.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 771.4 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.6.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 dcce5bd7d176c4821a7b7744f51a138de38a0dbd4cf117f007beb3924c6b1972
MD5 afb821a36567822c67722cac448b7e87
BLAKE2b-256 831eeb32715692eaa255073d96c42832bc793baee7f653da9dfb5df848dff1c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geompp-0.6.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bdd845285fd9a67ac4a9a6d4ce19314411aa5b495300986e817b6957db44659b
MD5 0a77bc5f1d6f20a1bccfa6f0f04c4141
BLAKE2b-256 c0dfa205f2149ee5d814cc387a2cb4696419ac3b4af6b05fce5ca7d90fa23a3b

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