Expand description
§quadrs
Experimental quad remeshing library and CLI tools based on Instant Meshes.
§Library
The public API is centered around Mesh, RemeshOptions, RemeshTarget, remesh, load_obj, and write_obj.
use quadrs::{remesh, Mesh, RemeshOptions, RemeshTarget, Vec3};
let mesh = Mesh {
vertices: vec![
Vec3::new(0.0, 0.0, 0.0),
Vec3::new(1.0, 0.0, 0.0),
Vec3::new(1.0, 1.0, 0.0),
Vec3::new(0.0, 1.0, 0.0),
],
faces: vec![vec![0, 1, 2], vec![0, 2, 3]],
};
let mut options = RemeshOptions::new(RemeshTarget::FaceCount(4));
options.seed = Some(1337);
let result = remesh(&mesh, &options)?;
assert!(result.mesh.faces.iter().all(|face| face.len() == 4));§CLI
Build:
cargo build --release --binsRemesh an OBJ file:
cargo run --release --bin remesh -- input.obj -o output.obj --target-faces 3000Use --seed 1337 to make a run reproducible. If --seed is omitted, remesh seeds itself from the current system time.
Run an end-to-end remesh check:
sh/test-remesh.sh teapot --target-faces 1000 --seed 1337It uses meshes/<name>.obj when present. For known public meshes such as teapot, it downloads meshes/<name>.obj on first run, builds remesh in release mode, and writes meshes/<name>-remeshed.obj.
Useful tools:
cargo run --release --bin mesh-stats -- output.obj§Reference
Run the C++ reference implementation directly:
scripts/run_reference.sh -d -i -b -f 3000 -o output.obj input.objscripts/run_reference.sh will:
- Check for an existing Instant Meshes binary.
- If missing, clone the reference repository into
/tmp/instant-meshes. - Build it into
/tmp/instant-meshes-build. - Run it with the arguments you provide.
§Sources
Original paper:
https://igl.ethz.ch/projects/instant-meshes/instant-meshes-SA-2015-jakob-et-al-compressed.pdf
Reference implementation:
https://github.com/wjakob/instant-meshes
Structs§
- Mesh
- Polygon mesh with 0-based vertex indices.
- Mesh
Report - Summary metrics for a polygon mesh.
- Remesh
Options - Configuration for a remeshing run.
- Remesh
Result - Output from a remeshing run.
Enums§
- Remesh
Error - Errors returned by the high-level remeshing API.
- Remesh
Mode - Optimization mode used for orientation and position matching.
- Remesh
Target - Output density target for the remesher.
Functions§
- analyze_
mesh - Computes summary metrics for a polygon mesh.
- load_
obj - Loads a mesh from an OBJ file.
- remesh
- Runs the full quad remeshing pipeline on a polygon mesh.
- write_
obj - Writes a mesh to an OBJ file.