X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgeometry%2Ftransformedshape.h;h=10789ed1e15bb2db2227b6d5e1fe1f12c5adfaca;hb=93e7cf250208c36befb4b1a7337f5302c0e1da54;hp=9a98f3139d85ef56edcd3fcdb1d8ab47116b6fee;hpb=6ff13022b53830d35283905d562c2ef3af198cc1;p=libs%2Fmath.git diff --git a/source/geometry/transformedshape.h b/source/geometry/transformedshape.h index 9a98f31..10789ed 100644 --- a/source/geometry/transformedshape.h +++ b/source/geometry/transformedshape.h @@ -9,7 +9,7 @@ namespace Msp { namespace Geometry { template -class TransformedShape +class TransformedShape: public Shape { private: Shape *shape; @@ -26,6 +26,7 @@ public: const Shape &get_shape() const { return *shape; } const AffineTransformation &get_transformation() const { return transformation; } + virtual HyperBox get_axis_aligned_bounding_box() const; virtual bool check_intersection(const Ray &) const; }; @@ -46,7 +47,7 @@ inline TransformedShape &TransformedShape::operator=(const Transform { delete shape; shape = other.shape->clone(); - transformation = other.transformation(); + transformation = other.transformation; } template @@ -61,6 +62,13 @@ inline TransformedShape *TransformedShape::clone() const return new TransformedShape(*this); } +template +inline HyperBox TransformedShape::get_axis_aligned_bounding_box() const +{ + // XXX This is not correct for most shapes + return shape->get_axis_aligned_bounding_box(); +} + template inline bool TransformedShape::check_intersection(const Ray &ray) const {