New methods

This commit is contained in:
Thomas Forgione
2018-03-16 13:48:04 +01:00
parent c32a378caf
commit 191ca7fdd6
4 changed files with 15 additions and 8 deletions
+2
View File
@@ -1,3 +1,5 @@
#![warn(missing_docs)]
extern crate num;
#[macro_use] extern crate verbose_log;
+11 -8
View File
@@ -9,7 +9,7 @@ macro_rules! make_bounding_box {
use math::vector::$vector;
/// Represents a bounding box.
#[derive(Clone)]
#[derive(Clone, Debug, PartialEq)]
pub struct $name<T> {
min: $vector<T>,
max: $vector<T>,
@@ -137,13 +137,16 @@ mod tests {
Vector3::new(3, 3, 3),
);
let b = b1.intersection(&b2);
assert_eq!(b.min().x(), 1);
assert_eq!(b.min().y(), 1);
assert_eq!(b.min().z(), 1);
let bb1 = b1.intersection(&b2);
assert_eq!(bb1.min().x(), 1);
assert_eq!(bb1.min().y(), 1);
assert_eq!(bb1.min().z(), 1);
assert_eq!(b.max().x(), 2);
assert_eq!(b.max().y(), 2);
assert_eq!(b.max().z(), 2);
assert_eq!(bb1.max().x(), 2);
assert_eq!(bb1.max().y(), 2);
assert_eq!(bb1.max().z(), 2);
let bb2 = b2.intersection(&b1);
assert_eq!(bb1, bb2);
}
}