New methods

This commit is contained in:
Thomas Forgione 2018-03-16 13:48:04 +01:00
parent c32a378caf
commit 191ca7fdd6
No known key found for this signature in database
GPG Key ID: C75CD416BD1FFCE1
4 changed files with 15 additions and 8 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
/target/
**/*.rs.bk
Cargo.lock
assets

View File

@ -7,6 +7,7 @@ authors = ["Thomas Forgione <thomas@tforgione.fr>"]
num = "*"
glium = "*"
verbose-log = { git = "https://gitea.tforgione.fr/dash-3d/verbose-log" }
byteorder = "*"
[[bin]]
name = "3d-viewer"

View File

@ -1,3 +1,5 @@
#![warn(missing_docs)]
extern crate num;
#[macro_use] extern crate verbose_log;

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);
}
}