diff --git a/src/cgmath/aabb.rs b/src/cgmath/aabb.rs index f80df23..3d3e351 100644 --- a/src/cgmath/aabb.rs +++ b/src/cgmath/aabb.rs @@ -18,6 +18,7 @@ use point::{Point, Point2, Point3}; use vector::{Vector, Vec2, Vec3}; use array::build; +use std::fmt; use std::num::{zero, one}; use std::iter::Iterator; @@ -91,6 +92,12 @@ impl Aabb, Point2, [S, ..2]> for Aabb2 { #[inline] fn max<'a>(&'a self) -> &'a Point2 { &self.mx } } +impl ToStr for Aabb2 { + fn to_str(&self) -> ~str { + format!("[{} - {}]", self.mn.to_str(), self.mx.to_str()) + } +} + #[deriving(Clone, Eq)] pub struct Aabb3 { mn: Point3, @@ -113,3 +120,9 @@ impl Aabb, Point3, [S, ..3]> for Aabb3 { #[inline] fn min<'a>(&'a self) -> &'a Point3 { &self.mn } #[inline] fn max<'a>(&'a self) -> &'a Point3 { &self.mx } } + +impl ToStr for Aabb3 { + fn to_str(&self) -> ~str { + format!("[{} - {}]", self.mn.to_str(), self.mx.to_str()) + } +}