ThreeCrate I/O
File I/O operations for point clouds and meshes in the threecrate ecosystem.
Features
- Point Cloud Formats: PLY, PCD, LAS, LAZ, XYZ/CSV file support
- Mesh Formats: OBJ, PLY file support with normals and textures
- Memory-Mapped I/O: High-performance reading of large binary files (optional)
- Streaming I/O: Memory-efficient reading and writing
- Error Handling: Comprehensive error reporting for invalid files
- Cross-platform: Works on Windows, macOS, and Linux
- OS-Gated Features: Platform-specific optimizations with automatic fallback
Supported Formats
Point Clouds
- PLY: Polygon File Format (ASCII and binary)
- PCD: Point Cloud Data format (ASCII and binary)
- LAS/LAZ: LiDAR data formats via Pasture
- XYZ/CSV: Comma-separated values with configurable columns
Meshes
- OBJ: Wavefront OBJ format with materials
- PLY: Triangle meshes in PLY format
Usage
Add this to your Cargo.toml
:
[]
= "0.1.0"
= "0.1.0"
Optional Features
las_laz
: Enable LAS/LAZ format support via Pastureio-mmap
: Enable memory-mapped I/O for improved performance on large binary files
[]
= { = "0.1.0", = ["io-mmap"] }
Examples
Basic Usage
use ;
use ;
// Auto-detect format and load point cloud
let cloud = read_point_cloud?;
println!;
// Save point cloud (format determined by extension)
write_point_cloud?;
// Load mesh from OBJ file
let mesh = read_mesh?;
println!;
Memory-Mapped I/O (io-mmap feature)
For large binary files, enable memory-mapped I/O for better performance:
use ;
// Memory mapping is automatically used for large binary files
// when the io-mmap feature is enabled
let ply_data = read_ply_file?;
let = read_pcd_file?;
// Check if memory mapping would be used
Benchmarking
Compare performance between memory-mapped and standard I/O:
# Run benchmarks (requires io-mmap feature)
# Run the memory mapping example
License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.