- // let a = Rect::from(("a".to_string(), "b".to_string())).area(); // this doesn't work, because area() is not implemented for String
+ // let a = Dimension::from(("a".to_string(), "b".to_string())).area(); // this doesn't work, because area() is not implemented for String
+ }
+
+ #[test]
+ fn intersection_of_lines() {
+ let p1 = point!(0.0, 0.0);
+ let p2 = point!(2.0, 2.0);
+ let p3 = point!(0.0, 2.0);
+ let p4 = point!(2.0, 0.0);
+ let r = Intersection::lines(p1, p2, p3, p4);
+ if let Intersection::Point(p) = r {
+ assert_eq!(p, point!(1.0, 1.0));
+ } else {
+ panic!();
+ }