Skip to main content

read_point_cloud_iter

Function read_point_cloud_iter 

Source
pub fn read_point_cloud_iter<P: AsRef<Path>>(
    path: P,
    chunk_size: Option<usize>,
) -> Result<Box<dyn Iterator<Item = Result<Point3f>> + Send + Sync>>
Expand description

Streaming point cloud reader for large files

This function returns an iterator that reads points one by one without loading the entire file into memory. Useful for processing very large point cloud files.

§Arguments

  • path - Path to the point cloud file
  • chunk_size - Optional chunk size for internal buffering (default: 1000)

§Returns

An iterator over Result<Point3f> where each item is either a point or an error

§Example

use threecrate_io::read_point_cloud_iter;
 
// Note: This will fail if the file doesn't exist, but demonstrates the API
match read_point_cloud_iter("large_cloud.ply", Some(5000)) {
    Ok(iter) => {
        for result in iter {
            match result {
                Ok(point) => println!("Point: {:?}", point),
                Err(e) => eprintln!("Error: {}", e),
            }
        }
    }
    Err(e) => eprintln!("Failed to open file: {}", e),
}