#![deny(warnings)]
use rust_3d::*;
#[test]
fn point_cloud_2d_test() {
let mut pc = PointCloud2D::<Point2D>::new();
assert!(pc.len() == 0);
let p = Point2D::new(0.1, 0.2);
pc.push(p);
assert!(pc.len() == 1);
assert!(pc.data[0].x() == 0.1);
assert!(pc.data[0].y() == 0.2);
assert!(pc.bounding_box_maybe().is_err());
let p = Point2D::new(0.2, 0.3);
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.max_p().x() == 0.2);
assert!(bb.max_p().y() == 0.3);
}
}
let pccloned = pc.clone();
assert!(pccloned.to_str() == "0.1 0.2\n0.2 0.3\n");
pc.move_by(1.0, 2.0);
println!("pc: {}", pc);
assert!(pc.to_str() == "1.1 2.2\n1.2 2.3\n");
}