KEYTransformation.h
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/*
3 * This file is part of the libetonyek project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10#ifndef KEYTRANSFORMATION_H_INCLUDED
11#define KEYTRANSFORMATION_H_INCLUDED
12
13#include "libetonyek_utils.h"
14
15namespace libetonyek
16{
17
18struct KEYGeometry;
19
30{
31public:
35
38 KEYTransformation(double xx, double yx, double xy, double yy, double x0, double y0);
39
48
56 void operator()(double &x, double &y, bool distance = false) const;
57
65 bool approxEqual(const KEYTransformation &other, double eps = KEY_EPSILON) const;
66
67private:
68 // transformation matrix
69 double m_xx;
70 double m_yx;
71 double m_xy;
72 double m_yy;
73 double m_x0;
74 double m_y0;
75};
76
85
93
101
108
110namespace transformations
111{
112
119KEYTransformation center(double width, double height);
120
129KEYTransformation origin(double width, double height);
130
137KEYTransformation flip(bool horizontal, bool vertical);
138
146
153KEYTransformation scale(double ratioX, double ratioY);
154
161KEYTransformation shear(double angleX, double angleY);
162
169KEYTransformation translate(double offsetX, double offsetY);
170
171}
172
173}
174
175#endif // KEYTRANSFORMATION_H_INCLUDED
176
177/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
double y
Definition: KEYShape.cpp:100
double x
Definition: KEYShape.cpp:99
Represents an affine transformation.
Definition: KEYTransformation.h:30
KEYTransformation()
Construct a unit transformation.
Definition: KEYTransformation.cpp:18
KEYTransformation & operator*=(const KEYTransformation &tr)
Apply a transformation on top of this one.
Definition: KEYTransformation.cpp:38
double m_xy
Definition: KEYTransformation.h:71
double m_xx
Definition: KEYTransformation.h:69
double m_y0
Definition: KEYTransformation.h:74
double m_yy
Definition: KEYTransformation.h:72
double m_x0
Definition: KEYTransformation.h:73
void operator()(double &x, double &y, bool distance=false) const
Apply transformation to a point or distance.
Definition: KEYTransformation.cpp:75
double m_yx
Definition: KEYTransformation.h:70
bool approxEqual(const KEYTransformation &other, double eps=KEY_EPSILON) const
Tests for approximate equality of transformations.
Definition: KEYTransformation.cpp:57
#define KEY_EPSILON
Definition: libetonyek_utils.h:57
@ angle
Definition: KEY1Token.h:92
@ width
Definition: KEY1Token.h:176
@ geometry
Definition: KEY2Token.h:213
@ height
Definition: KEY2Token.h:987
@ right
Definition: KEY2Token.h:1068
@ left
Definition: KEY2Token.h:1014
KEYTransformation origin(const double width, const double height)
Translate from the center of viewport to the origin.
Definition: KEYTransformation.cpp:136
KEYTransformation center(const double width, const double height)
Translate to the center of viewport.
Definition: KEYTransformation.cpp:131
KEYTransformation flip(const bool horizontal, const bool vertical)
Flip horizontally and/or vertically.
Definition: KEYTransformation.cpp:141
KEYTransformation shear(const double angleX, const double angleY)
Shear along x and/or y axis.
Definition: KEYTransformation.cpp:158
KEYTransformation translate(const double offsetX, const double offsetY)
Translate along x and/or y axis.
Definition: KEYTransformation.cpp:164
KEYTransformation scale(const double ratioX, const double ratioY)
Scale along x and/or y axis.
Definition: KEYTransformation.cpp:153
KEYTransformation rotate(const double angle)
Rotate counterclockwise around origin.
Definition: KEYTransformation.cpp:146
Definition: EtonyekDocument.cpp:41
bool operator==(const KEYPath &left, const KEYPath &right)
Definition: KEYPath.cpp:393
KEYPath operator*(const KEYPath &path, const KEYTransformation &tr)
Create a transformed path.
Definition: KEYPath.cpp:403
KEYTransformation makeTransformation(const KEYGeometry &geometry)
Create a transformation from a geometry.
Definition: KEYTransformation.cpp:99
bool operator!=(const KEYPath &left, const KEYPath &right)
Definition: KEYPath.cpp:398
Definition: KEYTypes.h:46

Generated for libetonyek by doxygen 1.9.3