From: Mikko Rasa Date: Sun, 19 May 2013 16:27:22 +0000 (+0300) Subject: TransformedShape should derive from Shape X-Git-Url: http://git.tdb.fi/?p=libs%2Fmath.git;a=commitdiff_plain;h=07a1aaf95d6a9e7e0ade2a10cc4e4b7f91486f98 TransformedShape should derive from Shape --- diff --git a/source/geometry/transformedshape.h b/source/geometry/transformedshape.h index 9a98f31..10af1e7 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; }; @@ -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 {