pasture
A Rust library for working with point cloud data. It features:
- Fine-grained support for arbitrary point attributes, similar to PDAL, but with added type safety
- A very flexible memory model, natively supporting both Array-of-Structs (AoS) and Struct-of-Arrays (SoA) memory layouts (which
pasturecalls 'interleaved' and 'columnar') - Support for reading and writing various point cloud formats with the
pasture-iocrate (such asLAS,LAZ,3D Tiles, as well as ASCII files) - A growing set of algorithms with the
pasture-algorithmscrate
To this end, pasture chooses flexibility over simplicity. If you are looking for something small and simple, for example to work with LAS files, try a crate like las. If you are planning to implement high-performance tools and services that will work with very large point cloud data, pasture is what you are looking for!
Usage
Add this to your Cargo.toml:
[dependencies]
pasture-core = "0.4.0"
# You probably also want I/O support
pasture-io = "0.4.0"
Here is an example on how to load a pointcloud from an LAS file and do something with it:
use ;
use ;
use ;
For more examples, check out the pasture_core examples and the pasture_io examples.
Migration from versions < 0.4
With version 0.4, the buffer API of pasture-core was rewritten. If you are migrating from an earlier version, here are some guidelines for migration. Also check out the documentation of the containers module.
New buffer types
The main buffer types were renamed:
InterleavedVecPointStorageis nowVectorBufferPerAttributeVecPointStorageis nowHashMapBuffer
The trait structure is also different:
PointBufferandPointBufferWriteableare replaced byBorrowedBuffer,BorrowedMutBuffer, andOwningBuffer, which define the ownership model of the buffer memoryInterleavedPointBufferandInterleavedPointBufferMutare nowInterleavedBufferandInterleavedBufferMutPerAttributePointBufferandPerAttributePointBufferMutare nowColumnarBufferandColumnarBufferMut. In general, the termPerAttributeis replaced by the more common termColumnar
There are no more extension traits (e.g. PointBufferExt). To get/set strongly typed point data, you now use views which can be obtained through the BorrowedBuffer and BorrowedBufferMut traits:
let view = buffer.view_attribute::<Vector3<f64>>(&POSITION_3D);
Views support strongly typed access to the data and are convertible to iterators.
New interface for readers and writers
The PointReader and PointWriter traits are no longer object safe. Instead, they have read and read_into methods that are strongly typed over the buffer type for improved efficiency. There is a GenericPointReader type, which uses static dispatch and encapsulates readers for LAS, LAZ, and 3D Tiles.
Development
pasture is in the early stages of development and bugs may occur.
License
pasture is distributed under the terms of the Apache License (Version 2.0). See LICENSE for details.