31 seged = b/l; |
31 seged = b/l; |
32 check(seged.x==1 && seged.y==2, "b/l"); |
32 check(seged.x==1 && seged.y==2, "b/l"); |
33 |
33 |
34 typedef BoundingBox<int> BB; |
34 typedef BoundingBox<int> BB; |
35 BB doboz1; |
35 BB doboz1; |
36 check(doboz1.empty(), "empty? Should be."); |
36 check(doboz1.empty(), "It should be empty."); |
37 |
37 |
38 doboz1 += a; |
38 doboz1 += a; |
39 check(!doboz1.empty(), "empty? Should not be."); |
39 check(!doboz1.empty(), "It should not be empty."); |
40 doboz1 += b; |
40 doboz1 += b; |
41 |
41 |
42 check(doboz1.bottomLeft().x==1 && |
42 check(doboz1.bottomLeft().x==1 && |
43 doboz1.bottomLeft().y==2 && |
43 doboz1.bottomLeft().y==2 && |
44 doboz1.topRight().x==3 && |
44 doboz1.topRight().x==3 && |
45 doboz1.topRight().y==4, |
45 doboz1.topRight().y==4, |
46 "added points to box"); |
46 "added points to box"); |
47 |
47 |
48 seged.x=2;seged.y=3; |
48 seged.x=2;seged.y=3; |
49 check(doboz1.inside(seged),"Inside? It should be."); |
49 check(doboz1.inside(seged),"It should be inside."); |
50 |
50 |
51 seged.x=1;seged.y=3; |
51 seged.x=1;seged.y=3; |
52 check(doboz1.inside(seged),"Inside? It should be."); |
52 check(doboz1.inside(seged),"It should be inside."); |
53 |
53 |
54 seged.x=0;seged.y=3; |
54 seged.x=0;seged.y=3; |
55 check(!doboz1.inside(seged),"Inside? It should not be."); |
55 check(!doboz1.inside(seged),"It should not be inside."); |
56 |
56 |
57 BB doboz2(seged); |
57 BB doboz2(seged); |
58 check(!doboz2.empty(), |
58 check(!doboz2.empty(), |
59 "empty? Should not be. Constructed from 1 point."); |
59 "It should not be empty. Constructed from 1 point."); |
60 |
60 |
61 doboz2 += doboz1; |
61 doboz2 += doboz1; |
62 check(doboz2.inside(seged), |
62 check(doboz2.inside(seged), |
63 "Not inside? It should be. Incremented a box with an other."); |
63 "It should be inside. Incremented a box with an other."); |
64 } |
64 } |