annotate Framework/Toolbox/AffineTransform2D.h @ 598:a806abb497b8

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 26 Apr 2019 17:57:57 +0200
parents 919226caca82
children 7912de3a15e0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
409
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
439
b70e9be013e4 preparing for 2019
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 409
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
409
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #pragma once
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #include "../StoneEnumerations.h"
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #include "LinearAlgebra.h"
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #include <Core/Images/ImageAccessor.h>
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 namespace OrthancStone
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 {
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 class AffineTransform2D
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 {
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 private:
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 Matrix matrix_;
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 public:
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 AffineTransform2D();
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 // The matrix must be 3x3, without perspective effects
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 AffineTransform2D(const Matrix& m);
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 AffineTransform2D(const AffineTransform2D& other) :
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 matrix_(other.matrix_)
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 {
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 }
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 const Matrix& GetHomogeneousMatrix() const
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 {
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 return matrix_;
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 }
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 void Apply(double& x /* inout */,
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 double& y /* inout */) const;
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 void Apply(Orthanc::ImageAccessor& target,
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 const Orthanc::ImageAccessor& source,
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 ImageInterpolation interpolation,
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 bool clear) const;
574
911297a277c4 AffineTransform2D::ConvertToOpenGLMatrix()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 439
diff changeset
59
911297a277c4 AffineTransform2D::ConvertToOpenGLMatrix()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 439
diff changeset
60 void ConvertToOpenGLMatrix(float target[16],
911297a277c4 AffineTransform2D::ConvertToOpenGLMatrix()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 439
diff changeset
61 unsigned int canvasWidth,
911297a277c4 AffineTransform2D::ConvertToOpenGLMatrix()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 439
diff changeset
62 unsigned int canvasHeight) const;
575
919226caca82 AffineTransform2D::ComputeZoom()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 574
diff changeset
63
919226caca82 AffineTransform2D::ComputeZoom()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 574
diff changeset
64 double ComputeZoom() const;
409
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 static AffineTransform2D Invert(const AffineTransform2D& a);
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 static AffineTransform2D Combine(const AffineTransform2D& a,
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 const AffineTransform2D& b);
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 static AffineTransform2D Combine(const AffineTransform2D& a,
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 const AffineTransform2D& b,
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 const AffineTransform2D& c);
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 static AffineTransform2D Combine(const AffineTransform2D& a,
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 const AffineTransform2D& b,
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 const AffineTransform2D& c,
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 const AffineTransform2D& d);
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 static AffineTransform2D CreateOffset(double dx,
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 double dy);
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 static AffineTransform2D CreateScaling(double sx,
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 double sy);
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 static AffineTransform2D CreateRotation(double angle);
574
911297a277c4 AffineTransform2D::ConvertToOpenGLMatrix()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 439
diff changeset
87
911297a277c4 AffineTransform2D::ConvertToOpenGLMatrix()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 439
diff changeset
88 static AffineTransform2D CreateOpenGLClipspace(unsigned int canvasWidth,
911297a277c4 AffineTransform2D::ConvertToOpenGLMatrix()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 439
diff changeset
89 unsigned int canvasHeight);
409
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 };
99c9b3238008 AffineTransform2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 }