pub fn reproject_point_cloud_between<'a, 'b, T1: BorrowedMutBuffer<'a>, T2: BorrowedMutBuffer<'b>>(
source_point_cloud: &'a mut T1,
target_point_cloud: &'b mut T2,
source_crs: &str,
target_crs: &str,
)
Expand description
Reprojection Algorithm Rewrites the 3D coordinates from the given point cloud to the given target coordinate reference system. It iterates over all points in the given point cloud. Make sure that source_crs and target_crs are valid coordinate reference systems.
§Panics
Panics if the PointLayout of this buffer does not contain the given attribute.
§Examples
#[repr(C, packed)]
#[derive(PointType, Debug, Clone, Copy, bytemuck::AnyBitPattern, bytemuck::NoUninit)]
struct SimplePoint {
#[pasture(BUILTIN_POSITION_3D)]
pub position: Vector3<f64>,
#[pasture(BUILTIN_INTENSITY)]
pub intensity: u16,
}
fn main() {
let points = vec![
SimplePoint {
position: Vector3::new(1.0, 22.0, 0.0),
intensity: 42,
},
SimplePoint {
position: Vector3::new(12.0, 23.0, 0.0),
intensity: 84,
},
SimplePoint {
position: Vector3::new(10.0, 8.0, 2.0),
intensity: 84,
},
SimplePoint {
position: Vector3::new(10.0, 0.0, 1.0),
intensity: 84,
},
];
let mut interleaved = points.into_iter().collect::<VectorBuffer>();
let mut attribute = HashMapBuffer::with_capacity(interleaved.len(), SimplePoint::layout());
attribute.resize(interleaved.len());
reproject_point_cloud_between(&mut interleaved, &mut attribute, "EPSG:4326", "EPSG:3309");
for point in attribute.view::<SimplePoint>() {
println!("{:?}", point);
}
}