Closed
Description
I get that the max
of the box structs are non-inclusive, and that is all fine. However, consider this code:
use euclid::default::{Box2D, Box3D, Point2D, Point3D};
fn main() {
let p2 = Point2D::new(1, 1);
let b2 = Box2D::from_points(vec![p2]);
assert!(!b2.is_empty());
assert!(b2.contains(p2));
let p3 = Point3D::new(1, 1, 1);
let b3 = Box3D::from_points(vec![p3]);
assert!(!b3.is_empty());
assert!(b3.contains(p3));
}
All of the above assertions fail, which seems to contradiction the documentation of the from_points
method, according to which it "Returns the smallest box containing all of the provided points." Basically the maximum point passed in will never actually be contained in the box.
This should be a very simple fix, and I'm happy to implement it once this has been confirmed as a genuine bug.
Metadata
Metadata
Assignees
Labels
No labels