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