Skip to main content

threecrate (Python)

Python bindings for threecrate — a high-performance 3D point cloud and mesh processing library written in Rust.

PyPI License

Installation

Pre-built wheels (no Rust required):

pip install threecrate

Build from source (requires Rust and maturin):

pip install maturin
cd threecrate-python
maturin develop --release

Quick Start

import numpy as np
import threecrate as tc

# Load a point cloud
cloud = tc.read_point_cloud("scan.ply")
print(cloud)  # PointCloud(120000 points)

# Or create from a numpy array (N, 3) float32
pts = np.random.rand(1000, 3).astype(np.float32)
cloud = tc.PointCloud.from_numpy(pts)

# Get points back as numpy
arr = cloud.to_numpy()  # shape (N, 3), dtype float32

API Reference

Types

Class Description
PointCloud XYZ point cloud. Construct with from_numpy() or read_point_cloud().
NormalPointCloud Point cloud with per-point surface normals. Returned by estimate_normals().
TriangleMesh Triangle mesh with vertices and faces.
IcpResult Registration result: transformation, mse, iterations, converged.
PlaneSegmentationResult RANSAC plane result: plane_coefficients(), inlier_indices(), inlier_cloud(), num_inliers.

Filtering

# Voxel grid downsampling
cloud = tc.voxel_downsample(cloud, voxel_size=0.05)

# Statistical outlier removal (default: k=20, std_ratio=2.0)
cloud = tc.remove_statistical_outliers(cloud, k_neighbors=20, std_ratio=2.0)

# Radius outlier removal
cloud = tc.remove_radius_outliers(cloud, radius=0.1, min_neighbors=5)

Normal Estimation

# Estimate normals using K nearest neighbours (default k=10)
normal_cloud = tc.estimate_normals(cloud, k_neighbors=10)

# Access positions and normals as numpy arrays
positions = normal_cloud.positions()  # (N, 3) float32
normals   = normal_cloud.normals()    # (N, 3) float32

Registration

# Point-to-point ICP
result = tc.icp(source, target, max_iterations=50)

print(result.converged)           # True / False
print(result.mse)                 # float
print(result.iterations)          # int
T = result.transformation()       # (4, 4) float32 numpy array

Segmentation

# RANSAC plane fitting
result = tc.segment_plane(cloud, threshold=0.01, max_iterations=1000)
coeffs = result.plane_coefficients()  # (4,) float32 [a, b, c, d]
indices = result.inlier_indices()     # list[int]
plane_cloud = result.inlier_cloud(cloud)   # PointCloud of inliers
print(result.num_inliers)

# Remove the dominant plane and keep the rest
non_plane_pts = [cloud.to_numpy()[i] for i in range(len(cloud))
                 if i not in set(indices)]

# Euclidean cluster extraction
clusters = tc.extract_clusters(cloud, tolerance=0.02,
                                min_cluster_size=100, max_cluster_size=25000)
for i, cluster in enumerate(clusters):
    print(f"Cluster {i}: {len(cluster)} points")

Mesh Simplification

# Reduce mesh to 50 % of original face count (quadric error decimation)
simplified = tc.simplify_mesh(mesh, reduction_ratio=0.5)
print(simplified.vertex_count, simplified.face_count)

Mesh Smoothing

# Laplacian smoothing (fast, mild shrinkage)
smooth = tc.smooth_mesh_laplacian(mesh, iterations=10, lambda_=0.5)

# Taubin smoothing (volume-preserving, recommended)
smooth = tc.smooth_mesh_taubin(mesh, iterations=10, lambda_=0.5, mu=-0.53)

# HC smoothing (good volume preservation with fine control)
smooth = tc.smooth_mesh_hc(mesh, iterations=10, alpha=0.0, beta=0.5)

Surface Reconstruction

# Automatic algorithm selection
mesh = tc.reconstruct(cloud)

# Poisson reconstruction (higher quality, requires normals)
normal_cloud = tc.estimate_normals(cloud)
mesh = tc.poisson_reconstruct(normal_cloud)

print(mesh.vertex_count)
print(mesh.face_count)
verts = mesh.vertices()  # (N, 3) float32
faces = mesh.faces()     # (M, 3) uint32

Mesh Health, Previews and 3D Printing

# Holes, pieces, flipped faces, watertight, size, area, volume, printable
report = tc.analyze_mesh(mesh)
print(report["printable"], report["problems"], report["size"], report["volume"])

# PNG from five views, no GPU needed. Orange = holes or inside-out faces.
tc.render([cloud, mesh], "check.png")
png = tc.render([mesh])                  # no path: returns the PNG bytes

# Point cloud or mesh in, watertight mesh out
printable, report = tc.repair_for_print(cloud, remove_floor=True, target_faces=200_000)
print(report["steps"], report["after"]["printable"])
tc.write_mesh(printable, "scan.printable.stl")

I/O

# Point clouds — PLY, PCD, XYZ, CSV, LAS, LAZ, E57
cloud = tc.read_point_cloud("scan.ply")
tc.write_point_cloud(cloud, "output.pcd")

# Meshes — PLY, OBJ, STL
mesh = tc.read_mesh("model.obj")
tc.write_mesh(mesh, "output.ply")

Full Example

import numpy as np
import threecrate as tc

# Load and preprocess
cloud = tc.read_point_cloud("scene.ply")
cloud = tc.voxel_downsample(cloud, voxel_size=0.02)
cloud = tc.remove_statistical_outliers(cloud, k_neighbors=20, std_ratio=2.0)

# Register two scans
source = tc.read_point_cloud("scan_a.ply")
target = tc.read_point_cloud("scan_b.ply")
result = tc.icp(source, target, max_iterations=100)
if result.converged:
    print(f"Aligned with MSE {result.mse:.4f}")
    print(result.transformation())

# Reconstruct surface
normal_cloud = tc.estimate_normals(cloud, k_neighbors=15)
mesh = tc.poisson_reconstruct(normal_cloud)
tc.write_mesh(mesh, "reconstruction.ply")
print(f"Mesh: {mesh.vertex_count} vertices, {mesh.face_count} faces")

Building from Source

Requirements: Rust 1.70+, Python 3.8+, maturin 1.x

# Install maturin
pip install maturin

# Development build (editable install)
cd threecrate-python
maturin develop --release

# Build a distributable wheel
maturin build --release --out dist/
pip install dist/threecrate-*.whl

License

Dual-licensed under MIT or Apache-2.0. See LICENSE-MIT for details.

Metadata

Release files for threecrate 0.12.0

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

Source distribution (sdist)

Source distribution for threecrate 0.12.0
File Size Uploaded Provenance Actions
threecrate-0.12.0.tar.gz 367.8 kB With provenance Details for threecrate-0.12.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for threecrate 0.12.0
File Actions
threecrate-0.12.0-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details for threecrate-0.12.0-cp38-abi3-win_amd64.whl
threecrate-0.12.0-cp38-abi3-manylinux_2_28_x86_64.whl CPython 3.8 abi3 Linux glibc 2.28+ x86-64 Details for threecrate-0.12.0-cp38-abi3-manylinux_2_28_x86_64.whl
threecrate-0.12.0-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details for threecrate-0.12.0-cp38-abi3-macosx_11_0_arm64.whl
threecrate-0.12.0-cp38-abi3-macosx_10_12_x86_64.whl CPython 3.8 abi3 macOS 10.12+ x86-64 Details for threecrate-0.12.0-cp38-abi3-macosx_10_12_x86_64.whl

Total release size: 6.6 MB

Release files / threecrate-0.12.0.tar.gz

Download URL threecrate-0.12.0.tar.gz
Size 367.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7fd16a9bd494b688ade71186dfd6c6567d4f60703fe20360f310728d92a54b53
BLAKE2b-256 checksum
How to use checksums
252efc18bd36df69c83de46fc0673d54401c2ad8894ded08b0e84e4d437ae04e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / threecrate-0.12.0-cp38-abi3-win_amd64.whl

Download URL threecrate-0.12.0-cp38-abi3-win_amd64.whl
Size 1.4 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
63866bc3e1fe3e6b4de8d98d75f4da982d99d5c5741a1c52268b90bd92e32926
BLAKE2b-256 checksum
How to use checksums
ee1eb2df205e6c3c8648d78ef8ae6f2acd681cfedef37fb7eb0f5da7acafe5aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / threecrate-0.12.0-cp38-abi3-manylinux_2_28_x86_64.whl

Download URL threecrate-0.12.0-cp38-abi3-manylinux_2_28_x86_64.whl
Size 1.8 MB
Tags CPython 3.8 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
252c2f9c05a020b77ba82cf82552b3f27aeaadeefcde9ece81b30a58c670f055
BLAKE2b-256 checksum
How to use checksums
c03ff44d539a560dcfcb8c95807756f83381ffdae05f85e2d3bdf9c09176357d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / threecrate-0.12.0-cp38-abi3-macosx_11_0_arm64.whl

Download URL threecrate-0.12.0-cp38-abi3-macosx_11_0_arm64.whl
Size 1.5 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4a8a7d59d20b8d3e721ba9a266fd1520658ef282407d3953ef33e7d7e6cca9d3
BLAKE2b-256 checksum
How to use checksums
4764c8a029130719d17eb6bd1305ea743996a3c2cbc468e00bc0711152918847
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / threecrate-0.12.0-cp38-abi3-macosx_10_12_x86_64.whl

Download URL threecrate-0.12.0-cp38-abi3-macosx_10_12_x86_64.whl
Size 1.5 MB
Tags CPython 3.8 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
aa81908a1b77b67fd956503c27693c5a6c267c0b960e260701404db1384d7768
BLAKE2b-256 checksum
How to use checksums
fbbd40427696db49440c9e1b1d694204350d458bba20bddff21d9aa3d54bdbfa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Security for threecrate 0.12.0

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.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for threecrate-0.12.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

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