Smesh – Mesh→Point-Cloud Sensor Simulator (core skeleton)
Project description
Smesh – filthy-fast mesh→point cloud simulator
This is a minimal, type-annotated implementation of the critical core components for the Smesh simulator:
MeshScene(mesh IO + attribute probing via VTK)Intersector(VTK OBBTree + optional Embree viatrimesh[ray])PointBatchcontainerAttributeComputerplug-ins (range, incidence, scan angle, returns, intensity, gps time, color/normal probe, beam footprint)LasWriterwith streaming support and dynamic ExtraBytesSamplerorchestrator which glues everything together
Installation
Examples below use uv for reproducible runs, but a standard Python workflow works too:
python -m venv .venv
source .venv/bin/activate
pip install -e .
Installing straight from GitHub
To pull the latest main branch directly into a virtualenv:
pip install git+https://github.com/Chiark-Collective/smesh.git
For a reproducible install, pin to a tag (e.g., git+https://github.com/Chiark-Collective/smesh.git@v0.1.0).
Quick taste
import numpy as np
from smesh import MeshScene, Sampler, SamplerConfig, AutoIntersector, LasWriter
from smesh.core.intersector import RayBundle
scene = MeshScene(mesh_path="scene.ply")
# Make a tiny fan of rays from above
M = 1000
origins = np.tile(np.array([[0,0,10.0]]), (M,1))
dirs = np.tile(np.array([[0,0,-1.0]]), (M,1))
bundle = RayBundle(origins=origins, directions=dirs, max_range=100.0, multi_hit=False, meta={"gps_time": np.arange(M)*1e-3})
sampler = Sampler(scene, intersector=AutoIntersector(), cfg=SamplerConfig())
writer = LasWriter("out.las", compress=False)
stats = sampler.run_to_writer(writer, ray_batches=[bundle])
print(stats)
Note: for VTK-backed attribute probing and fast VTK intersector, install
vtk. For Embree, installtrimesh[ray]which pullspyembree(and requires Intel Embree runtime).
CLI & Preview Runs
Quickly sample a scenario from YAML:
uv run smesh sample examples/configs/preview/aerial_lidar_preview.yaml
Override outputs or attributes on the fly:
uv run smesh sample examples/configs/preview/mobile_lidar_preview.yaml \
--output scratch/mobile.las --attribute range --attribute scan_angle
Generate fresh preview point clouds and web-friendly images for the key capture modes:
uv run python scripts/render_examples.py # preview configs (fast)
uv run python scripts/render_examples.py --full # full-resolution configs
# or, without uv:
python -m smesh.cli sample examples/configs/preview/aerial_lidar_preview.yaml
The script writes point clouds into examples/outputs/ and PNG composites into examples/images/.
Workflow Examples
| Capture | Preview | Command |
|---|---|---|
| Aerial LiDAR | uv run smesh sample examples/configs/preview/aerial_lidar_preview.yaml |
|
| Mobile LiDAR | uv run smesh sample examples/configs/preview/mobile_lidar_preview.yaml |
|
| Total Station | uv run smesh sample examples/configs/preview/total_station_preview.yaml |
|
| Photogrammetry | uv run smesh sample examples/configs/preview/photogrammetry_preview.yaml |
Each preview config runs in under a minute on CPU-only machines, producing lightweight outputs for quick inspection. Higher fidelity counterparts live in examples/configs/ and can be regenerated by rerunning scripts/render_examples.py --full.
Output writers
LasWriterstreams directly to disk batch-by-batch (compression optional).PlyWriterandNpzWriterbuffer incoming batches in memory and emit a single file whenclose()is called. Callclose()explicitly if you manage the writer yourself.
Attribute pipeline notes
The sampler now orders attribute computers based on their declared dependencies. Custom attribute chains still work—dependencies like range_m for intensity will be inserted automatically so long as a matching producer exists.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smesh-0.0.1.tar.gz.
File metadata
- Download URL: smesh-0.0.1.tar.gz
- Upload date:
- Size: 43.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1bf331e8d0ab97a2e6f2efe24bacc581515f9dd0aaf391c36862a1d3249d3ac0
|
|
| MD5 |
bf99681799c9dfc34e155a6ab5a4e1df
|
|
| BLAKE2b-256 |
b2e3a261df23d3a5774b12dec46e78f89d5e8850d92261c29962cafa61e5d38d
|
File details
Details for the file smesh-0.0.1-py3-none-any.whl.
File metadata
- Download URL: smesh-0.0.1-py3-none-any.whl
- Upload date:
- Size: 50.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9cb01cc69f2783ff4128388e149848a18f2dc00c4a8ff50ad8678ccb603868d
|
|
| MD5 |
0c8c77d547cf8055e94a2278392a7a58
|
|
| BLAKE2b-256 |
bb76e2cc9250a36ff8020b1aff2097ad4669ce9633acb403df4f51a04698e86b
|