gadomski / las-rs

Read and write ASPRS las files, Rust edition.
MIT License
73 stars 32 forks source link

Add API that allows reading many points #68

Closed tmontaigu closed 6 months ago

tmontaigu commented 7 months ago

This adds to the API of the reader some functions that allows to read many points in one call.

There are few variants, depending on how the user wants to be conservative with allocations.

Also ideally, there would be a read_into(&mut self, buf: &mut [Point]) -> Result<u64> In order to avoid more allocations (especially the potential extra bytes), but for that there needs to exist a Point::read_into(raw: &RawPoint, dest_point: &mut Point) or similar. Which could be added later.

The main point for these methods, is that it will later allow to make use of laz-rs parrallel decompressor to greatly speed-up reading LAZ files.

If needed, we could add later an iterator that returns vecs of points e.g:

fn chunks(points_per_chunk: u64) -> impl Iterator<Item=Vec<Point>>>