physdes/
lib.rs

1// pub mod halton_int;
2pub mod generic;
3pub mod interval;
4pub mod merge_obj;
5pub mod point;
6pub mod polygon;
7pub mod rpolygon;
8pub mod vector2;
9
10pub use crate::point::Point;
11pub use crate::polygon::Polygon;
12pub use crate::rpolygon::RPolygon;
13pub use crate::vector2::Vector2;
14
15#[cfg(test)]
16mod tests {
17    use super::*;
18    extern crate interval;
19    use interval::ops::*;
20    use interval::Interval;
21    use quickcheck_macros::quickcheck;
22
23    #[test]
24    pub fn it_works() {
25        let a = Point::<i32, i32>::new(12, 23);
26        let b = Vector2::<i32, i32>::new(34, 45);
27        println!("{:?}", a + b);
28        println!("{:?}", a - b);
29
30        let mut a = Point::<i32, i32>::new(42, 53);
31        a += b;
32        a -= b;
33        println!("{:?}", -a);
34
35        let c = Point::<i32, i32>::new(12, 23);
36        let mm = Point::<Point<i32, i32>, Point<i32, i32>>::new(a, c);
37        println!("{:?}", mm);
38
39        let x = Interval::<i32>::new(12, 23);
40        // let y = Interval::<i32>::new(42, 53);
41        println!("{:?}", x);
42
43        // let _x = Interval::<i32>::new(12, 23);
44        // let _y = Interval::<i32>::new(42, 53);
45        // let r = Rect::<i32, i32>::new(x, y);
46        // println!("{:?}", r);
47
48        // let mm = Matrix2::<i32, i32>::new(a, b);
49        // println!("{:?}", mm);
50    }
51
52    #[quickcheck]
53    fn check_point(ax: u16, bx: u16) -> bool {
54        let a = Point::<i32, i32>::new(ax as i32, 23);
55        let b = Vector2::<i32, i32>::new(bx as i32, 45);
56        a == (a - b) + b
57    }
58}