diff --git a/src/box3d.rs b/src/box3d.rs index 7640af2..e802515 100644 --- a/src/box3d.rs +++ b/src/box3d.rs @@ -84,6 +84,22 @@ impl Box3D { Box3D { min, max } } + /// Constructor. + #[inline] + pub fn from_origin_and_size(origin: Point3D, size: Size3D) -> Self + where + T: Copy + Add, + { + Box3D { + min: origin, + max: point3( + origin.x + size.width, + origin.y + size.height, + origin.z + size.depth, + ), + } + } + /// Creates a Box3D of the given size, at offset zero. #[inline] pub fn from_size(size: Size3D) -> Self