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