-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtransformations.h
More file actions
88 lines (71 loc) · 2.27 KB
/
Copy pathtransformations.h
File metadata and controls
88 lines (71 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#ifndef TRANSFORMATIONS_H
#define TRANSFORMATIONS_H
#include <cmath>
#include "Object/object3d.h"
#include "matrix3.h"
#include "basetransformatorimp.h"
class BaseTransformation
{
public:
BaseTransformation() = default;
virtual ~BaseTransformation() = default;
virtual void transform(std::shared_ptr<Object3D> obj, std::shared_ptr<BaseTransformatorImp> imp) = 0;
};
class ShiftTransformation : public BaseTransformation
{
public:
ShiftTransformation(Point3D delta);
~ShiftTransformation() = default;
virtual void transform(std::shared_ptr<Object3D> obj, std::shared_ptr<BaseTransformatorImp> imp) override;
private:
Point3D _delta;
};
class MatrixTransformation : public BaseTransformation
{
public:
MatrixTransformation(const Matrix3<float> &m);
~MatrixTransformation() = default;
virtual void transform(std::shared_ptr<Object3D> obj, std::shared_ptr<BaseTransformatorImp> imp) override;
private:
Matrix3<float> _m;
};
class ScaleTransformation : public BaseTransformation
{
public:
ScaleTransformation(Point3D koef, Point3D center);
~ScaleTransformation() = default;
virtual void transform(std::shared_ptr<Object3D> obj, std::shared_ptr<BaseTransformatorImp> imp) override;
private:
Point3D _koef;
Point3D _center;
};
class RotateTransformation : public BaseTransformation
{
public:
RotateTransformation(Point3D angle, Point3D center);
~RotateTransformation() = default;
virtual void transform(std::shared_ptr<Object3D> obj, std::shared_ptr<BaseTransformatorImp> imp) override;
private:
Point3D _angle;
Point3D _center;
};
class ProjectTransformation : public BaseTransformation
{
public:
ProjectTransformation(double _c);
~ProjectTransformation() = default;
virtual void transform(std::shared_ptr<Object3D> obj, std::shared_ptr<BaseTransformatorImp> imp) override;
private:
double _c;
};
class CompositeTransformation : public BaseTransformation
{
public:
CompositeTransformation() = default;
~CompositeTransformation() = default;
virtual void transform(std::shared_ptr<Object3D> obj, std::shared_ptr<BaseTransformatorImp> imp) override;
void add(std::shared_ptr<BaseTransformation> tr);
private:
std::vector<std::shared_ptr<BaseTransformation>> _trs;
};
#endif // TRANSFORMATIONS_H