X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgeometry%2Fnegation.h;h=8e2b3f41a6d7c30681026176330d0ed1a04d965e;hb=7d43d93ac2d701bb3de87cdf81e44c03e64c35c3;hp=beb3e4e7b845d91edcaff45555add550a8165cd3;hpb=09cc3a8648dd20e9a07d669b353c4a120b67c1c4;p=libs%2Fmath.git diff --git a/source/geometry/negation.h b/source/geometry/negation.h index beb3e4e..8e2b3f4 100644 --- a/source/geometry/negation.h +++ b/source/geometry/negation.h @@ -1,7 +1,6 @@ #ifndef MSP_GEOMETRY_NEGATION_H_ #define MSP_GEOMETRY_NEGATION_H_ -#include "boundingbox.h" #include "shape.h" namespace Msp { @@ -19,6 +18,9 @@ private: public: Negation(const Shape &); + Negation(const Negation &); + Negation &operator=(const Negation &); + ~Negation(); virtual Negation *clone() const; @@ -35,6 +37,25 @@ inline Negation::Negation(const Shape &s): shape(s.clone()) { } +template +inline Negation::Negation(const Negation &other): + shape(other.shape->clone()) +{ } + +template +inline Negation &Negation::operator=(const Negation &other) +{ + delete shape; + shape = other.shape->clone(); + return *this; +} + +template +inline Negation::~Negation() +{ + delete shape; +} + template inline Negation *Negation::clone() const { @@ -58,7 +79,10 @@ inline unsigned Negation::get_intersections(const Ray &ray, SurfaceP { unsigned count = shape->get_intersections(ray, points, size); for(unsigned i=0; i