physdes/
lib.rs

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