#![deny(warnings)]
use rust_3d::*;
#[test]
fn test_point_cloud_3d() {
let mut pc = PointCloud3D::<Point3D>::new();
assert!(pc.len() == 0);
let p = Point3D::new(0.1, 0.2, 0.3);
pc.push(p);
assert!(pc.len() == 1);
assert!(pc.data[0].x() == 0.1);
assert!(pc.data[0].y() == 0.2);
assert!(pc.data[0].z() == 0.3);
assert!(pc.bounding_box_maybe().is_err());
let p = Point3D::new(0.2, 0.3, 0.4);
pc.push(p);
assert!(pc.len() == 2);
assert!(pc.bounding_box_maybe().is_ok());
match pc.bounding_box_maybe() {
Err(_) => assert!(false),
Ok(bb) => {
assert!(bb.min_p().x() == 0.1);
assert!(bb.min_p().y() == 0.2);
assert!(bb.min_p().z() == 0.3);
assert!(bb.max_p().x() == 0.2);
assert!(bb.max_p().y() == 0.3);
assert!(bb.max_p().z() == 0.4);
}
}
let pccloned = pc.clone();
assert!(pccloned.to_str() == "0.1 0.2 0.3\n0.2 0.3 0.4\n");
pc.move_by(1.0, 2.0, 3.0);
println!("pc: {}", pc);
assert!(pc.to_str() == "1.1 2.2 3.3\n1.2 2.3 3.4\n");
}