| [e09b70] | 1 | /*
 | 
|---|
 | 2 |  * ShapeOps_impl.hpp
 | 
|---|
 | 3 |  *
 | 
|---|
 | 4 |  *  Created on: Jun 18, 2010
 | 
|---|
 | 5 |  *      Author: crueger
 | 
|---|
 | 6 |  */
 | 
|---|
 | 7 | 
 | 
|---|
 | 8 | #ifndef SHAPEOPS_IMPL_HPP_
 | 
|---|
 | 9 | #define SHAPEOPS_IMPL_HPP_
 | 
|---|
 | 10 | 
 | 
|---|
 | 11 | #include "Shapes/Shape_impl.hpp"
 | 
|---|
 | 12 | #include "vector.hpp"
 | 
|---|
| [5e588b5] | 13 | #include "Matrix.hpp"
 | 
|---|
| [e09b70] | 14 | 
 | 
|---|
| [5de9da] | 15 | class ShapeOpsBase_impl : public Shape_impl{
 | 
|---|
 | 16 | public:
 | 
|---|
 | 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);
 | 
|---|
 | 22 | protected:
 | 
|---|
 | 23 |   virtual Vector translateIn(const Vector &point)=0;
 | 
|---|
 | 24 |   virtual Vector translateOutPos(const Vector &point)=0;
 | 
|---|
 | 25 |   virtual Vector translateOutNormal(const Vector &point)=0;
 | 
|---|
| [cfda65] | 26 |   Shape::impl_ptr getArg();
 | 
|---|
| [5de9da] | 27 | private:
 | 
|---|
 | 28 |   Shape::impl_ptr arg;
 | 
|---|
 | 29 | };
 | 
|---|
 | 30 | 
 | 
|---|
 | 31 | class Resize_impl :  public ShapeOpsBase_impl
 | 
|---|
| [e09b70] | 32 | {
 | 
|---|
 | 33 | public:
 | 
|---|
 | 34 |   Resize_impl(const Shape::impl_ptr&,double);
 | 
|---|
 | 35 |   virtual ~Resize_impl();
 | 
|---|
| [5de9da] | 36 | protected:
 | 
|---|
 | 37 |   virtual Vector translateIn(const Vector &point);
 | 
|---|
 | 38 |   virtual Vector translateOutPos(const Vector &point);
 | 
|---|
 | 39 |   virtual Vector translateOutNormal(const Vector &point);
 | 
|---|
| [cfda65] | 40 |   virtual std::string toString();
 | 
|---|
| [e09b70] | 41 | private:
 | 
|---|
 | 42 |   double size;
 | 
|---|
 | 43 | };
 | 
|---|
 | 44 | 
 | 
|---|
| [5de9da] | 45 | class Translate_impl :  public ShapeOpsBase_impl
 | 
|---|
| [e09b70] | 46 | {
 | 
|---|
 | 47 | public:
 | 
|---|
 | 48 |   Translate_impl(const Shape::impl_ptr&, const Vector&);
 | 
|---|
 | 49 |   virtual ~Translate_impl();
 | 
|---|
| [5de9da] | 50 | protected:
 | 
|---|
 | 51 |   virtual Vector translateIn(const Vector &point);
 | 
|---|
 | 52 |   virtual Vector translateOutPos(const Vector &point);
 | 
|---|
 | 53 |   virtual Vector translateOutNormal(const Vector &point);
 | 
|---|
| [cfda65] | 54 |   virtual std::string toString();
 | 
|---|
| [e09b70] | 55 | private:
 | 
|---|
 | 56 |   Vector offset;
 | 
|---|
 | 57 | };
 | 
|---|
 | 58 | 
 | 
|---|
| [5de9da] | 59 | class Stretch_impl : public ShapeOpsBase_impl
 | 
|---|
| [5e588b5] | 60 | {
 | 
|---|
 | 61 | public:
 | 
|---|
 | 62 |   Stretch_impl(const Shape::impl_ptr&, const Vector&);
 | 
|---|
 | 63 |   virtual ~Stretch_impl();
 | 
|---|
| [5de9da] | 64 | protected:
 | 
|---|
 | 65 |   virtual Vector translateIn(const Vector &point);
 | 
|---|
 | 66 |   virtual Vector translateOutPos(const Vector &point);
 | 
|---|
 | 67 |   virtual Vector translateOutNormal(const Vector &point);
 | 
|---|
| [cfda65] | 68 |   virtual std::string toString();
 | 
|---|
| [5e588b5] | 69 | private:
 | 
|---|
 | 70 |   Vector factors;
 | 
|---|
 | 71 |   Vector reciFactors;
 | 
|---|
 | 72 | };
 | 
|---|
 | 73 | 
 | 
|---|
| [5de9da] | 74 | class Transform_impl : public ShapeOpsBase_impl
 | 
|---|
| [5e588b5] | 75 | {
 | 
|---|
 | 76 | public:
 | 
|---|
 | 77 |   Transform_impl(const Shape::impl_ptr&, const Matrix&);
 | 
|---|
 | 78 |   virtual ~Transform_impl();
 | 
|---|
| [5de9da] | 79 | protected:
 | 
|---|
 | 80 |   virtual Vector translateIn(const Vector &point);
 | 
|---|
 | 81 |   virtual Vector translateOutPos(const Vector &point);
 | 
|---|
 | 82 |   virtual Vector translateOutNormal(const Vector &point);
 | 
|---|
| [cfda65] | 83 |   virtual std::string toString();
 | 
|---|
| [5e588b5] | 84 | private:
 | 
|---|
 | 85 |   Matrix transformation;
 | 
|---|
 | 86 |   Matrix transformationInv;
 | 
|---|
 | 87 | };
 | 
|---|
 | 88 | 
 | 
|---|
| [e09b70] | 89 | #endif /* SHAPEOPS_IMPL_HPP_ */
 | 
|---|