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 config.h
|
---|
12 | #ifdef HAVE_CONFIG_H
|
---|
13 | #include <config.h>
|
---|
14 | #endif
|
---|
15 |
|
---|
16 |
|
---|
17 | #include "Shapes/Shape_impl.hpp"
|
---|
18 | #include "Shapes/ShapeExceptions.hpp"
|
---|
19 | #include "LinearAlgebra/Vector.hpp"
|
---|
20 | #include "LinearAlgebra/RealSpaceMatrix.hpp"
|
---|
21 |
|
---|
22 | #include <vector>
|
---|
23 |
|
---|
24 | class LineSegment;
|
---|
25 |
|
---|
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);
|
---|
33 | virtual LineSegmentSet getLineIntersections(const Line&);
|
---|
34 | virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
|
---|
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;
|
---|
39 | Shape::impl_ptr getArg() const;
|
---|
40 | private:
|
---|
41 | Shape::impl_ptr arg;
|
---|
42 | };
|
---|
43 |
|
---|
44 | class Resize_impl : public ShapeOpsBase_impl
|
---|
45 | {
|
---|
46 | public:
|
---|
47 | Resize_impl(const Shape::impl_ptr&,double);
|
---|
48 | virtual ~Resize_impl();
|
---|
49 | protected:
|
---|
50 | virtual Vector translateIn(const Vector &point);
|
---|
51 | virtual Vector translateOutPos(const Vector &point);
|
---|
52 | virtual Vector translateOutNormal(const Vector &point);
|
---|
53 | virtual std::string toString();
|
---|
54 | virtual bool isInside(const Vector& point);
|
---|
55 | virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
|
---|
56 | private:
|
---|
57 | double size;
|
---|
58 | };
|
---|
59 |
|
---|
60 | class Translate_impl : public ShapeOpsBase_impl
|
---|
61 | {
|
---|
62 | public:
|
---|
63 | Translate_impl(const Shape::impl_ptr&, const Vector&);
|
---|
64 | virtual ~Translate_impl();
|
---|
65 | protected:
|
---|
66 | virtual Vector translateIn(const Vector &point);
|
---|
67 | virtual Vector translateOutPos(const Vector &point);
|
---|
68 | virtual Vector translateOutNormal(const Vector &point);
|
---|
69 | virtual std::string toString();
|
---|
70 | virtual bool isInside(const Vector& point);
|
---|
71 | virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
|
---|
72 | private:
|
---|
73 | Vector offset;
|
---|
74 | };
|
---|
75 |
|
---|
76 | class Stretch_impl : public ShapeOpsBase_impl
|
---|
77 | {
|
---|
78 | public:
|
---|
79 | Stretch_impl(const Shape::impl_ptr&, const Vector&);
|
---|
80 | virtual ~Stretch_impl();
|
---|
81 | protected:
|
---|
82 | virtual Vector translateIn(const Vector &point);
|
---|
83 | virtual Vector translateOutPos(const Vector &point);
|
---|
84 | virtual Vector translateOutNormal(const Vector &point);
|
---|
85 | virtual std::string toString();
|
---|
86 | virtual bool isInside(const Vector& point);
|
---|
87 | virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
|
---|
88 | private:
|
---|
89 | Vector factors;
|
---|
90 | Vector reciFactors;
|
---|
91 | };
|
---|
92 |
|
---|
93 | class Transform_impl : public ShapeOpsBase_impl
|
---|
94 | {
|
---|
95 | public:
|
---|
96 | Transform_impl(const Shape::impl_ptr&, const RealSpaceMatrix&);
|
---|
97 | virtual ~Transform_impl();
|
---|
98 | protected:
|
---|
99 | virtual Vector translateIn(const Vector &point);
|
---|
100 | virtual Vector translateOutPos(const Vector &point);
|
---|
101 | virtual Vector translateOutNormal(const Vector &point);
|
---|
102 | virtual std::string toString();
|
---|
103 | virtual bool isInside(const Vector& point);
|
---|
104 | virtual std::vector<Vector> getHomogeneousPointsOnSurface(const size_t N) const;
|
---|
105 | private:
|
---|
106 | RealSpaceMatrix transformation;
|
---|
107 | RealSpaceMatrix transformationInv;
|
---|
108 | };
|
---|
109 |
|
---|
110 | #endif /* SHAPEOPS_IMPL_HPP_ */
|
---|