pub fn reproject_point_cloud_within<'a, T: BorrowedMutBuffer<'a>>(
point_cloud: &'a mut T,
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>();
reproject_point_cloud_within(
&mut interleaved,
"EPSG:4326",
"EPSG:3309",
);
for point in interleaved.view::<SimplePoint>() {
println!("{:?}", point);
}
}