Skip to main content

trueform — NumPy for Geometry

Fast and exact mesh booleans, spatial queries, arrangements, registration, and remeshing on NumPy arrays. NumPy in, NumPy out.

Read the article: The STL for Geometry — What the STL philosophy of separating algorithms from data looks like when applied to geometry.

polydera.com/trueform | Documentation | ▶ Try it live

Installation

pip install trueform

Quick Tour

Primitives — typed NumPy arrays, single or batched:

import numpy as np
import trueform as tf

triangle = tf.Triangle(a=[0, 0, 0], b=[1, 0, 0], c=[0, 1, 0])
segment = tf.Segment([[0, 0, 0], [1, 1, 1]])
ray = tf.Ray(origin=[0.2, 0.2, -1], direction=[0, 0, 1])

# Add a leading dimension for batches
pts = tf.Point(np.random.rand(1000, 3).astype(np.float32))
segs = tf.Segment(start=np.random.rand(500, 3), end=np.random.rand(500, 3))

Meshes are created from NumPy arrays or read from files:

points = np.array([
    [0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1]
], dtype=np.float32)
faces = np.array([
    [0, 1, 2], [0, 2, 3], [0, 3, 1], [1, 3, 2]
], dtype=np.int32)

mesh = tf.Mesh(faces, points)

# Or read from file
mesh = tf.Mesh(*tf.read_stl("model.stl"))

Queries — same functions for any combination. Batches broadcast:

# Batch × Primitive — distance field to a plane
plane = tf.Plane(normal=[0, 0, 1], offset=0.0)
scalars = tf.distance(pts, plane)                    # shape (1000,)

# Batch × Form — closest point on mesh for each segment
ids, dist2s, closest = tf.neighbor_search(mesh, segs) # 3 arrays, shape (500,)

# Single × Single
dist2, pt_a, pt_b = tf.closest_metric_point_pair(triangle, segment)

if (t := tf.ray_cast(ray, triangle)) is not None:
    hit_point = ray.origin + t * np.array(ray.direction)

Boolean operations:

(result_faces, result_points), labels, face_labels = tf.boolean_union(mesh0, mesh1)

# With intersection curves
(result_faces, result_points), labels, face_labels, (paths, curve_points) = tf.boolean_union(
    mesh0, mesh1, return_curves=True
)

Remeshing:

# Decimate to 50%
dec_faces, dec_points = tf.decimated(mesh, 0.5)

# Isotropic remesh to uniform edge lengths
dec_mesh = tf.Mesh(dec_faces, dec_points)
mel = tf.mean_edge_length(dec_mesh)
rem_faces, rem_points = tf.isotropic_remeshed(dec_mesh, mel)

→ Full documentation covers mesh analysis, topology, isocontours, curvature, and more.

Tutorials

One task per page, with full code, on polydera.com:

→ All tutorials

Examples

Run examples locally:

git clone https://github.com/polydera/trueform.git
cd trueform/python/examples
pip install vtk  # for interactive examples
python vtk/collision.py mesh.stl

PyVista Integration

Booleans, intersection curves, repairs, and isocontours on PyVista meshes through a .trueform accessor. pip install pyvista-trueform — see pyvista-trueform.

Blender Integration

Cached meshes with automatic dirty-tracking for live preview add-ons. See Blender docs.

Benchmarks

Operation Input Time Speedup Baseline TrueForm
Boolean Union 2 × 1M 28 ms 6× MeshLib (int32 exact + SoS) exact predicates, canonical topology
Mesh–Mesh Curves 2 × 1M 7 ms 233× CGAL Exact_predicates_inexact_constructions_kernel exact predicates, canonical topology
ICP Registration 1M 7.7 ms 93× libigl AABB tree, random subsampling
Self-Intersection 1M 78 ms 37× libigl EPECK (GMP/MPFR) exact predicates, canonical topology
Isocontours 1M, 16 cuts 3.8 ms 38× VTK vtkContourFilter exact predicates
Connected Components 1M 15 ms 10× CGAL parallel union-find
Boundary Paths 1M 12 ms 11× CGAL Hierholzer's algorithm
k-NN Query 500K 1.7 µs 3× nanoflann k-d tree AABB tree
Mesh–Mesh Distance 2 × 1M 0.2 ms 2× Coal (FCL) OBBRSS OBBRSS tree
Decimation (50%) 1M 72 ms 50× CGAL edge_collapse parallel partitioned collapse
Principal Curvatures 1M 25 ms 55× libigl parallel k-ring quadric fitting

Apple M4 Max, 16 threads, Clang -O3. Full methodology

License

Dual-licensed: PolyForm Noncommercial 1.0.0 for noncommercial use, commercial licenses available.

Contributing

See CONTRIBUTING.md and open issues.

Citation

@software{trueform2025,
    title={trueform: the CSG Engine},
    author={Sajovic, {\v{Z}}iga and {et al.}},
    organization={Polydera},
    year={2025},
    url={https://github.com/polydera/trueform}
}

Metadata

Release files for trueform 0.10.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for trueform 0.10.10
File Size Uploaded Provenance Actions
trueform-0.10.10.tar.gz 2.2 MB Without provenance Details for trueform-0.10.10.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for trueform 0.10.10
File Actions
trueform-0.10.10-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for trueform-0.10.10-cp313-cp313-win_amd64.whl
trueform-0.10.10-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for trueform-0.10.10-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
trueform-0.10.10-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details for trueform-0.10.10-cp313-cp313-macosx_11_0_arm64.whl
trueform-0.10.10-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for trueform-0.10.10-cp312-cp312-win_amd64.whl
trueform-0.10.10-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for trueform-0.10.10-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
trueform-0.10.10-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for trueform-0.10.10-cp312-cp312-macosx_11_0_arm64.whl
trueform-0.10.10-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for trueform-0.10.10-cp311-cp311-win_amd64.whl
trueform-0.10.10-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for trueform-0.10.10-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
trueform-0.10.10-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for trueform-0.10.10-cp311-cp311-macosx_11_0_arm64.whl

Total release size: 561.2 MB

Release files / trueform-0.10.10.tar.gz

Download URL trueform-0.10.10.tar.gz
Size 2.2 MB
Tags Source
SHA-256 checksum
How to use checksums
329f554d3a1722800af02ae6861076f7f2d2a75f4dca12e3f02aa2d7e2f5b826
BLAKE2b-256 checksum
How to use checksums
c96d0ffdc65aa225218eaf9a44bf49ced3844c69b07c2d325aee802a7d59b3dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / trueform-0.10.10-cp313-cp313-win_amd64.whl

Download URL trueform-0.10.10-cp313-cp313-win_amd64.whl
Size 33.8 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
281e3fbe3ed1b6e95f60d38da963d5e984d51ff0308e9c5a2f61697388a46f85
BLAKE2b-256 checksum
How to use checksums
580ca45bce7604f1ef56cadc3ea3a5e62fba5b90c2c1e9337cc8f78c6ba8783b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / trueform-0.10.10-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL trueform-0.10.10-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 90.5 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
281d255183609d656b6311b8333d5be74c802486c132a85bd94a370fdd52dd5a
BLAKE2b-256 checksum
How to use checksums
1136732f4749f63fe3c503fd16e6047fe1a9145bb257cf47720db0f80e5b2097
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / trueform-0.10.10-cp313-cp313-macosx_11_0_arm64.whl

Download URL trueform-0.10.10-cp313-cp313-macosx_11_0_arm64.whl
Size 62.0 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ad3b2da7849ae6e3fc6fbd2f95fe7eab8e8a41b094cab05873ca02521ab0d557
BLAKE2b-256 checksum
How to use checksums
ea2311d9074a47b9aaf6af266879f62bd37500c2f23db2519d6eb196ebaf25c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / trueform-0.10.10-cp312-cp312-win_amd64.whl

Download URL trueform-0.10.10-cp312-cp312-win_amd64.whl
Size 33.8 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
a75274801695d2757f91b9a5973a35e5ed0b6a6f92aa67d6e7d221f1e50783bd
BLAKE2b-256 checksum
How to use checksums
0aca234416a9bb93403581820654e2cdd0f95efb33686ceb66f76c1517acc2f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / trueform-0.10.10-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL trueform-0.10.10-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 90.5 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
222dca7b755df5ead5cb460e64f35d1ae1143bf326322bb4a129ebda8b86c8c4
BLAKE2b-256 checksum
How to use checksums
d3c5304813bd6f444fe896539047af7c5802fb39029f66f3f80254aa4ed4bd17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / trueform-0.10.10-cp312-cp312-macosx_11_0_arm64.whl

Download URL trueform-0.10.10-cp312-cp312-macosx_11_0_arm64.whl
Size 62.0 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f727b22ab7cdcc2990bfe1150842f8cfd1e7f6eb42118a250936eee8d37c914b
BLAKE2b-256 checksum
How to use checksums
adba87d3afb2714d29fffc0d6860f4de1f00776c8d20b7ec34431151743d0a59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / trueform-0.10.10-cp311-cp311-win_amd64.whl

Download URL trueform-0.10.10-cp311-cp311-win_amd64.whl
Size 33.8 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
55ae3a4eda48fdd04afd474e3f2ddc2530998799adb91483bfdb741b844da5aa
BLAKE2b-256 checksum
How to use checksums
cce91089a4039a738e690b1de6178a0c4f9ac07ea994aa865e70fe4306a5eea3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / trueform-0.10.10-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL trueform-0.10.10-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 90.5 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
e13073a1f25d49931a9d62f91e9cbe839030ce7e555796e428e2cd89968dd24a
BLAKE2b-256 checksum
How to use checksums
bbe29858afd0a9d91b7c2d17d0cd1de33a295be18ef6f42e3da4badadfba3b11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / trueform-0.10.10-cp311-cp311-macosx_11_0_arm64.whl

Download URL trueform-0.10.10-cp311-cp311-macosx_11_0_arm64.whl
Size 62.0 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
fda7015ab4be81aa0118bf499f4e56151c896b6e1067ad7a182d86d18f9f602f
BLAKE2b-256 checksum
How to use checksums
1b616fb489f22e76ff834116517f27b272cdffbb83d0f71e5db7fb6c45e415b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for trueform 0.10.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page