| [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 |  | 
|---|
| [56f73b] | 11 | // include config.h | 
|---|
|  | 12 | #ifdef HAVE_CONFIG_H | 
|---|
|  | 13 | #include <config.h> | 
|---|
|  | 14 | #endif | 
|---|
|  | 15 |  | 
|---|
|  | 16 |  | 
|---|
| [e09b70] | 17 | #include "Shapes/Shape_impl.hpp" | 
|---|
| [57f243] | 18 | #include "LinearAlgebra/Vector.hpp" | 
|---|
| [cca9ef] | 19 | #include "LinearAlgebra/RealSpaceMatrix.hpp" | 
|---|
| [e09b70] | 20 |  | 
|---|
| [6c438f] | 21 | #include <vector> | 
|---|
|  | 22 |  | 
|---|
|  | 23 | class LineSegment; | 
|---|
| [e09b70] | 24 |  | 
|---|
| [5de9da] | 25 | class ShapeOpsBase_impl : public Shape_impl{ | 
|---|
|  | 26 | public: | 
|---|
|  | 27 | ShapeOpsBase_impl(const Shape::impl_ptr&); | 
|---|
|  | 28 | virtual ~ShapeOpsBase_impl(); | 
|---|
|  | 29 | virtual bool isInside(const Vector &point); | 
|---|
|  | 30 | virtual bool isOnSurface(const Vector &point); | 
|---|
|  | 31 | virtual Vector getNormal(const Vector &point) throw (NotOnSurfaceException); | 
|---|
| [c6f395] | 32 | virtual LineSegmentSet getLineIntersections(const Line&); | 
|---|
| [6c438f] | 33 | virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const; | 
|---|
| [5de9da] | 34 | protected: | 
|---|
|  | 35 | virtual Vector translateIn(const Vector &point)=0; | 
|---|
|  | 36 | virtual Vector translateOutPos(const Vector &point)=0; | 
|---|
|  | 37 | virtual Vector translateOutNormal(const Vector &point)=0; | 
|---|
| [6c438f] | 38 | Shape::impl_ptr getArg() const; | 
|---|
| [5de9da] | 39 | private: | 
|---|
|  | 40 | Shape::impl_ptr arg; | 
|---|
|  | 41 | }; | 
|---|
|  | 42 |  | 
|---|
|  | 43 | class Resize_impl :  public ShapeOpsBase_impl | 
|---|
| [e09b70] | 44 | { | 
|---|
|  | 45 | public: | 
|---|
|  | 46 | Resize_impl(const Shape::impl_ptr&,double); | 
|---|
|  | 47 | virtual ~Resize_impl(); | 
|---|
| [5de9da] | 48 | protected: | 
|---|
|  | 49 | virtual Vector translateIn(const Vector &point); | 
|---|
|  | 50 | virtual Vector translateOutPos(const Vector &point); | 
|---|
|  | 51 | virtual Vector translateOutNormal(const Vector &point); | 
|---|
| [cfda65] | 52 | virtual std::string toString(); | 
|---|
| [e09b70] | 53 | virtual bool isInside(const Vector& point); | 
|---|
| [9c1c89] | 54 | virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const; | 
|---|
| [e09b70] | 55 | private: | 
|---|
|  | 56 | double size; | 
|---|
|  | 57 | }; | 
|---|
|  | 58 |  | 
|---|
| [5de9da] | 59 | class Translate_impl :  public ShapeOpsBase_impl | 
|---|
| [e09b70] | 60 | { | 
|---|
|  | 61 | public: | 
|---|
|  | 62 | Translate_impl(const Shape::impl_ptr&, const Vector&); | 
|---|
|  | 63 | virtual ~Translate_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(); | 
|---|
| [e09b70] | 69 | virtual bool isInside(const Vector& point); | 
|---|
| [9c1c89] | 70 | virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const; | 
|---|
| [e09b70] | 71 | private: | 
|---|
|  | 72 | Vector offset; | 
|---|
|  | 73 | }; | 
|---|
|  | 74 |  | 
|---|
| [5de9da] | 75 | class Stretch_impl : public ShapeOpsBase_impl | 
|---|
| [5e588b5] | 76 | { | 
|---|
|  | 77 | public: | 
|---|
|  | 78 | Stretch_impl(const Shape::impl_ptr&, const Vector&); | 
|---|
|  | 79 | virtual ~Stretch_impl(); | 
|---|
| [5de9da] | 80 | protected: | 
|---|
|  | 81 | virtual Vector translateIn(const Vector &point); | 
|---|
|  | 82 | virtual Vector translateOutPos(const Vector &point); | 
|---|
|  | 83 | virtual Vector translateOutNormal(const Vector &point); | 
|---|
| [cfda65] | 84 | virtual std::string toString(); | 
|---|
| [5e588b5] | 85 | virtual bool isInside(const Vector& point); | 
|---|
| [9c1c89] | 86 | virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const; | 
|---|
| [5e588b5] | 87 | private: | 
|---|
|  | 88 | Vector factors; | 
|---|
|  | 89 | Vector reciFactors; | 
|---|
|  | 90 | }; | 
|---|
|  | 91 |  | 
|---|
| [5de9da] | 92 | class Transform_impl : public ShapeOpsBase_impl | 
|---|
| [5e588b5] | 93 | { | 
|---|
|  | 94 | public: | 
|---|
| [cca9ef] | 95 | Transform_impl(const Shape::impl_ptr&, const RealSpaceMatrix&); | 
|---|
| [5e588b5] | 96 | virtual ~Transform_impl(); | 
|---|
| [5de9da] | 97 | protected: | 
|---|
|  | 98 | virtual Vector translateIn(const Vector &point); | 
|---|
|  | 99 | virtual Vector translateOutPos(const Vector &point); | 
|---|
|  | 100 | virtual Vector translateOutNormal(const Vector &point); | 
|---|
| [cfda65] | 101 | virtual std::string toString(); | 
|---|
| [5e588b5] | 102 | virtual bool isInside(const Vector& point); | 
|---|
| [9c1c89] | 103 | virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const; | 
|---|
| [5e588b5] | 104 | private: | 
|---|
| [cca9ef] | 105 | RealSpaceMatrix transformation; | 
|---|
|  | 106 | RealSpaceMatrix transformationInv; | 
|---|
| [5e588b5] | 107 | }; | 
|---|
|  | 108 |  | 
|---|
| [e09b70] | 109 | #endif /* SHAPEOPS_IMPL_HPP_ */ | 
|---|