From 07a1aaf95d6a9e7e0ade2a10cc4e4b7f91486f98 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 19 May 2013 19:27:22 +0300 Subject: [PATCH] TransformedShape should derive from Shape --- source/geometry/transformedshape.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 { -- 2.45.2