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.4.0.tar.gz (19.7 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.4.0-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12Windows x86-64

geompp-0.4.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (5.2 MB view details)

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

geompp-0.4.0-cp311-cp311-win_amd64.whl (2.2 MB view details)

Uploaded CPython 3.11Windows x86-64

geompp-0.4.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.1 MB view details)

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

geompp-0.4.0-cp310-cp310-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.10Windows x86-64

geompp-0.4.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (3.1 MB view details)

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

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

Uploaded CPython 3.9Windows x86-64

geompp-0.4.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.1 MB view details)

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

geompp-0.4.0-cp38-cp38-win_amd64.whl (746.0 kB view details)

Uploaded CPython 3.8Windows x86-64

geompp-0.4.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.1 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.4.0.tar.gz.

File metadata

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

File hashes

Hashes for geompp-0.4.0.tar.gz
Algorithm Hash digest
SHA256 34452263ed34f91bbeefe51e096cf74a845c8473d77cb826d24916498ca2f7df
MD5 dfd321a779953788591f89864e2f6e08
BLAKE2b-256 b08f005d9ec3b9e72514a03b738270ff28df8aa35c2ebd705223b387ca4e7312

See more details on using hashes here.

File details

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

File metadata

  • Download URL: geompp-0.4.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 2.7 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.4.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4f2ad6255b90dbb08b69e0c37369c082f069e216806d86f0969e4b8ccce28186
MD5 433707d861523af85a69d78db8f00f38
BLAKE2b-256 cc18bfe40f293fb0634176fea3500ed8d5ce308cca89be553b8aade38051e996

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geompp-0.4.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3ad0336a3ececaaf55b3cc7747ba97eef9cba5fc1f72ddfcfe810b0d758b7f43
MD5 d2f8b59f17d853c3e37294776f18ebe3
BLAKE2b-256 f458fbe2aa4cacfe35af2f3625719e916c199caaf1603c24e0673fa5ebff4e88

See more details on using hashes here.

File details

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

File metadata

  • Download URL: geompp-0.4.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 2.2 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.4.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 53970d1cecbaa7ae8ee1a6934e3c24a3ace2138a8e462157cd5119348ae4fdff
MD5 76b9c3dfaaf982ca137601cacaedd67e
BLAKE2b-256 55d0bf6d06657e9b659304092915883042e45d168f41a861b740a4c95a424dec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geompp-0.4.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4b681449c3b0b29267e73eab2847770933dffb13795d6e0ce0997654c12c6d0c
MD5 81dcf1d5cbd9edd59298f2d0acd10b1c
BLAKE2b-256 c2010ffdf46da186a2969fa205772c480781c25d5ead81e4dac057e58ddc0db8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: geompp-0.4.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 1.7 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.4.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b40956ef297e23ff40f1227e2ec1b9b3d8505393d76bbbadc8bbee395d377384
MD5 8d150234ef9149775966b0cf7efd9df7
BLAKE2b-256 fc2a4f418dc3a421c691a3dfaffced5f85edf1e6b7a6b33ff03912e2d5bbdae0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geompp-0.4.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f52912b20c0d6b00af8b98b0b5a3492362fdac5c52a95b354a4f4cb36956d80e
MD5 f54d44967925583e11179cb722a85e9d
BLAKE2b-256 38463408d9a45d74ccae9eb29a60ba553cd24e4a18bc73f1679658cca587ebd4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: geompp-0.4.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.4.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 35cd3b7f201db25021559a628ef8531b79f01c35fbf4999550272c245da22bb2
MD5 42405a7810cb339eb7b365054285f5f4
BLAKE2b-256 9650980f5e61a8091e1bf823b1469f279a238826b264d5cc2c8c1b5bc43b2f6b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geompp-0.4.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2a5ac63e9195a38d94d68f632caceb9288d48e252917d6409b81188bb0c728ef
MD5 6d054522734e2cdf5d00d8bdc19e61db
BLAKE2b-256 12fe5e7fb3cdc8afcce5e22808f68e3d3ffedafa296c3081083d61399a13eed8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: geompp-0.4.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 746.0 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.4.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 53bb3a29759a4bf8bfdfcd67164575e1472728e0c7cf59e317ffbecee32ad3ac
MD5 eeafb5abbb60c1e884783dd281d5b08c
BLAKE2b-256 bdb2b82cba62c840a93d26c83e546200abf2c853d45540512227d3b9d120c73f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geompp-0.4.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 77aa878ca1f70f808d2e301e96b7cf915497d00359017d7c0ac53884229ee278
MD5 828c1a274f7bd2aa9994f429d3a18e32
BLAKE2b-256 ff0b20fbbd4eccd3a1195d25c25ddd8b59dddbace012eedc3e710cb6f1b7bdc5

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