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