| Crates.io | threecrate-io |
| lib.rs | threecrate-io |
| version | 0.5.0 |
| created_at | 2025-07-09 10:56:51.185539+00 |
| updated_at | 2025-09-27 10:52:29.803206+00 |
| description | I/O operations for point clouds and meshes in threecrate |
| homepage | https://github.com/rajgandhi1/threecrate.git |
| repository | https://github.com/rajgandhi1/threecrate.git |
| max_upload_size | |
| id | 1744748 |
| size | 353,182 |
File I/O operations for point clouds and meshes in the threecrate ecosystem.
Add this to your Cargo.toml:
[dependencies]
threecrate-io = "0.1.0"
threecrate-core = "0.1.0"
las_laz: Enable LAS/LAZ format support via Pastureio-mmap: Enable memory-mapped I/O for improved performance on large binary files[dependencies]
threecrate-io = { version = "0.1.0", features = ["io-mmap"] }
use threecrate_io::{read_point_cloud, write_point_cloud, read_mesh};
use threecrate_core::{PointCloud, Point3f};
// Auto-detect format and load point cloud
let cloud = read_point_cloud("input.ply")?;
println!("Loaded {} points", cloud.len());
// Save point cloud (format determined by extension)
write_point_cloud(&cloud, "output.pcd")?;
// Load mesh from OBJ file
let mesh = read_mesh("model.obj")?;
println!("Loaded mesh with {} vertices", mesh.vertices.len());
For large binary files, enable memory-mapped I/O for better performance:
use threecrate_io::{RobustPlyReader, RobustPcdReader};
// Memory mapping is automatically used for large binary files
// when the io-mmap feature is enabled
let ply_data = RobustPlyReader::read_ply_file("large_cloud.ply")?;
let (header, points) = RobustPcdReader::read_pcd_file("large_cloud.pcd")?;
// Check if memory mapping would be used
#[cfg(feature = "io-mmap")]
{
let would_use_mmap = threecrate_io::mmap::should_use_mmap("large_cloud.ply");
println!("Would use memory mapping: {}", would_use_mmap);
}
Compare performance between memory-mapped and standard I/O:
# Run benchmarks (requires io-mmap feature)
cargo bench --features io-mmap mmap_benchmarks
# Run the memory mapping example
cargo run --example mmap_example --features io-mmap
This project is licensed under either of
at your option.