]> git.tdb.fi Git - libs/math.git/blobdiff - source/geometry/transformedshape.h
Some more member mis-use fixes
[libs/math.git] / source / geometry / transformedshape.h
index 9a98f3139d85ef56edcd3fcdb1d8ab47116b6fee..10789ed1e15bb2db2227b6d5e1fe1f12c5adfaca 100644 (file)
@@ -9,7 +9,7 @@ namespace Msp {
 namespace Geometry {
 
 template<typename T, unsigned D>
-class TransformedShape
+class TransformedShape: public Shape<T, D>
 {
 private:
        Shape<T, D> *shape;
@@ -26,6 +26,7 @@ public:
        const Shape<T, D> &get_shape() const { return *shape; }
        const AffineTransformation<T, D> &get_transformation() const { return transformation; }
 
+       virtual HyperBox<T, D> get_axis_aligned_bounding_box() const;
        virtual bool check_intersection(const Ray<T, D> &) const;
 };
 
@@ -46,7 +47,7 @@ inline TransformedShape<T, D> &TransformedShape<T, D>::operator=(const Transform
 {
        delete shape;
        shape = other.shape->clone();
-       transformation = other.transformation();
+       transformation = other.transformation;
 }
 
 template<typename T, unsigned D>
@@ -61,6 +62,13 @@ inline TransformedShape<T, D> *TransformedShape<T, D>::clone() const
        return new TransformedShape<T, D>(*this);
 }
 
+template<typename T, unsigned D>
+inline HyperBox<T, D> TransformedShape<T, D>::get_axis_aligned_bounding_box() const
+{
+       // XXX This is not correct for most shapes
+       return shape->get_axis_aligned_bounding_box();
+}
+
 template<typename T, unsigned D>
 inline bool TransformedShape<T, D>::check_intersection(const Ray<T, D> &ray) const
 {