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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.11Windows x86-64

geompp-0.5.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.3 MB view details)

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

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.9Windows x86-64

geompp-0.5.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.5.0-cp38-cp38-win_amd64.whl (770.7 kB view details)

Uploaded CPython 3.8Windows x86-64

geompp-0.5.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.5.0.tar.gz.

File metadata

  • Download URL: geompp-0.5.0.tar.gz
  • Upload date:
  • Size: 21.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.5.0.tar.gz
Algorithm Hash digest
SHA256 77d7cb77f86d159fc0c30e1cd84bf772bf5c791f6e2c4de20f4688968ab2a4ee
MD5 9f951053c8c6f0469abd245ff46a8b3c
BLAKE2b-256 48b1cd09d2b11d79e3d1853f72953dc5901431dd6f75bf2b6b0f02e9dddc053b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: geompp-0.5.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.5.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 79e585610c9801c1445cace4425859a806f33359c6925c8aa360cb9bd66b4203
MD5 f944dc544d6de3afd0bf4868ec95a2ae
BLAKE2b-256 53d64eccd170e953c7d37be225b6a8ba438922404e4c0d73006dce19a70b83ac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geompp-0.5.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 35ab90d59c38d9368fbfd16a2dd2c9fa7cd860bced377d16b66f77aef8b10330
MD5 e08132233c855243d68e6ab012728a56
BLAKE2b-256 100770e9eb49efc18b1dfadac351d0ca7ac1d9a1dfe513ec368c4dd157762ce9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: geompp-0.5.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.5.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2aa18273684db400508da6e8b0ca790a7f37565f127dcf4a124c9c5ab80d7b5f
MD5 76333ff8bc1827a167a287c0807cce4f
BLAKE2b-256 cd2faf840e59db9b2261082c7d2b8890152adf3efcb444ce032a901f6dc73698

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geompp-0.5.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5f26e42442a62ea2dea768a8b53fe5d7104571d2e82565d021aea9c4a176d395
MD5 cdfd400a148d1e3bfce8c56ef021951f
BLAKE2b-256 9c3946a52df4880406e9214967ce51dc570b2d2f045cc501f63edc682d5cd83f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: geompp-0.5.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.5.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d399301f58da1175a4f89bf50856d4ac83ef8b06ff7e8f3e850a5cbc9b33d351
MD5 af5dbb148f94869ee5cf7f4f13f81fe7
BLAKE2b-256 5d125b427813161fa58ca530f211aa270f25bed6852358584639e634e662f56c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geompp-0.5.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 99ae1f52b44f5fbd2aa81236d197b2baea6603d03b03f6d8f6be3364ebb1cfdb
MD5 27dc30a80fc7c7e429130127aef3866b
BLAKE2b-256 e2eb9f0aa37edb57e194f5e3a13a8619a6135b04a6bcf9562c036e4cd5f44112

See more details on using hashes here.

File details

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

File metadata

  • Download URL: geompp-0.5.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.5.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 c36cf2213f77ea36866c8d610c93a08a762103133a9019d3e30c6a611fb028c4
MD5 27fd43400ecb4582b966ccd58b1a600b
BLAKE2b-256 5ff0fda723e57746a20deb584d9efc78dd2e4c39e97b6362fc3ad22a6db50071

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geompp-0.5.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2f5481274ba1163bb25fa6f626279361fd59bc8aea39e33af633c6c575b968fa
MD5 3f29d43a600b003f736fa4680b5a7f0b
BLAKE2b-256 b422a1abc7eed6f8db339a1e7721edba1f1f4e1bff2651b759eee7096e1b2010

See more details on using hashes here.

File details

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

File metadata

  • Download URL: geompp-0.5.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 770.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.5.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 9c8f359e35b40c6772d21dfdad830ba87d9c976953018bd339489d48592dbb78
MD5 317bbd61554ff0d76383698dc524e668
BLAKE2b-256 bd660553e0a980e549b81ebcbb6d3678779f8cda12a44ccf06712ea9ea9c8bf9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geompp-0.5.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 058eec197ec501a1ee1d79fd030c64af0090cb2635d3fc04d984b44cb62749d0
MD5 67eb4b60bb3825ea8d33a23eb4966f44
BLAKE2b-256 01e8699b8c7379a47b31820cba90b7b8da83ad9b08f5af074f0aaa7d53712a17

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