Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Shapes/ShapeOps_impl.hpp

    r5e588b5 rcfda65  
    1313#include "Matrix.hpp"
    1414
    15 class Resize_impl :  public Shape_impl
     15class ShapeOpsBase_impl : public Shape_impl{
     16public:
     17  ShapeOpsBase_impl(const Shape::impl_ptr&);
     18  virtual ~ShapeOpsBase_impl();
     19  virtual bool isInside(const Vector &point);
     20  virtual bool isOnSurface(const Vector &point);
     21  virtual Vector getNormal(const Vector &point) throw (NotOnSurfaceException);
     22protected:
     23  virtual Vector translateIn(const Vector &point)=0;
     24  virtual Vector translateOutPos(const Vector &point)=0;
     25  virtual Vector translateOutNormal(const Vector &point)=0;
     26  Shape::impl_ptr getArg();
     27private:
     28  Shape::impl_ptr arg;
     29};
     30
     31class Resize_impl :  public ShapeOpsBase_impl
    1632{
    1733public:
    1834  Resize_impl(const Shape::impl_ptr&,double);
    1935  virtual ~Resize_impl();
    20   virtual bool isInside(const Vector& point);
     36protected:
     37  virtual Vector translateIn(const Vector &point);
     38  virtual Vector translateOutPos(const Vector &point);
     39  virtual Vector translateOutNormal(const Vector &point);
     40  virtual std::string toString();
    2141private:
    22   Shape::impl_ptr arg;
    2342  double size;
    2443};
    2544
    26 class Translate_impl :  public Shape_impl
     45class Translate_impl :  public ShapeOpsBase_impl
    2746{
    2847public:
    2948  Translate_impl(const Shape::impl_ptr&, const Vector&);
    3049  virtual ~Translate_impl();
    31   virtual bool isInside(const Vector& point);
     50protected:
     51  virtual Vector translateIn(const Vector &point);
     52  virtual Vector translateOutPos(const Vector &point);
     53  virtual Vector translateOutNormal(const Vector &point);
     54  virtual std::string toString();
    3255private:
    33   Shape::impl_ptr arg;
    3456  Vector offset;
    3557};
    3658
    37 class Stretch_impl : public Shape_impl
     59class Stretch_impl : public ShapeOpsBase_impl
    3860{
    3961public:
    4062  Stretch_impl(const Shape::impl_ptr&, const Vector&);
    4163  virtual ~Stretch_impl();
    42   virtual bool isInside(const Vector& point);
     64protected:
     65  virtual Vector translateIn(const Vector &point);
     66  virtual Vector translateOutPos(const Vector &point);
     67  virtual Vector translateOutNormal(const Vector &point);
     68  virtual std::string toString();
    4369private:
    44   Shape::impl_ptr arg;
    4570  Vector factors;
    4671  Vector reciFactors;
    4772};
    4873
    49 class Transform_impl : public Shape_impl
     74class Transform_impl : public ShapeOpsBase_impl
    5075{
    5176public:
    5277  Transform_impl(const Shape::impl_ptr&, const Matrix&);
    5378  virtual ~Transform_impl();
    54   virtual bool isInside(const Vector& point);
     79protected:
     80  virtual Vector translateIn(const Vector &point);
     81  virtual Vector translateOutPos(const Vector &point);
     82  virtual Vector translateOutNormal(const Vector &point);
     83  virtual std::string toString();
    5584private:
    56   Shape::impl_ptr arg;
    5785  Matrix transformation;
    5886  Matrix transformationInv;
Note: See TracChangeset for help on using the changeset viewer.