pub struct CopcReader { /* private fields */ }Expand description
A parsed COPC file ready for spatial queries.
§Example
ⓘ
use oxigdal_copc::copc_reader::CopcReader;
use oxigdal_copc::point::BoundingBox3D;
let data = std::fs::read("my_file.copc.laz").expect("read file");
let reader = CopcReader::from_bytes(&data).expect("parse COPC");
let bbox = BoundingBox3D::new(0.0, 0.0, 0.0, 100.0, 100.0, 50.0).expect("valid bbox");
let points = reader.query_points_in_bbox(&bbox).expect("query");Implementations§
Source§impl CopcReader
impl CopcReader
Sourcepub fn from_bytes(data: &[u8]) -> Result<Self, CopcError>
pub fn from_bytes(data: &[u8]) -> Result<Self, CopcError>
Sourcepub fn octree_bounds(&self) -> BoundingBox3D
pub fn octree_bounds(&self) -> BoundingBox3D
Return the full octree bounding box as a BoundingBox3D.
Sourcepub fn query_points_in_bbox(
&self,
bbox: &BoundingBox3D,
) -> Result<Vec<Point3D>, CopcError>
pub fn query_points_in_bbox( &self, bbox: &BoundingBox3D, ) -> Result<Vec<Point3D>, CopcError>
Query all points whose positions fall within the given 3D bounding box.
Traverses the COPC hierarchy to find octree nodes that intersect
bbox, reads the corresponding point data chunks and deserializes
them, then filters to only those points geometrically inside bbox.
§Errors
Returns CopcError on hierarchy traversal or point deserialization
errors.
Sourcepub fn count_intersecting_chunks(
&self,
bbox: &BoundingBox3D,
) -> Result<Vec<HierarchyEntry>, CopcError>
pub fn count_intersecting_chunks( &self, bbox: &BoundingBox3D, ) -> Result<Vec<HierarchyEntry>, CopcError>
Return the total number of hierarchy entries (data chunks) that intersect the given bounding box, without reading point data.
Useful for estimating query cost before fetching actual points.
Sourcepub fn entries_at_depth(
&self,
depth: i32,
) -> Result<Vec<HierarchyEntry>, CopcError>
pub fn entries_at_depth( &self, depth: i32, ) -> Result<Vec<HierarchyEntry>, CopcError>
Return all hierarchy entries at a given depth level.
This traverses the full hierarchy and filters by depth.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CopcReader
impl RefUnwindSafe for CopcReader
impl Send for CopcReader
impl Sync for CopcReader
impl Unpin for CopcReader
impl UnsafeUnpin for CopcReader
impl UnwindSafe for CopcReader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more