VectorTransformation2D.h Source File documentation

VectorTransformation2D.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 libmspub 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 INCLUDED_VECTORTRANSFORMATION2D_H
11#define INCLUDED_VECTORTRANSFORMATION2D_H
12
13namespace libmspub
14{
15 struct Vector2D
16{
17 double m_x;
18 double m_y;
19 Vector2D(double x, double y) : m_x(x), m_y(y)
20 {
21 }
22};
23Vector2D operator+(const Vector2D &l, const Vector2D &r);
24Vector2D operator-(const Vector2D &l, const Vector2D &r);
25 class VectorTransformation2D
26{
27 double m_m11, m_m12, m_m21, m_m22;
28 double m_x, m_y;
29public:
30 VectorTransformation2D();
31 Vector2D transform(Vector2D original) const;
32 Vector2D transformWithOrigin(Vector2D v, Vector2D origin) const;
33 double getRotation() const;
34 double getHorizontalScaling() const;
35 double getVerticalScaling() const;
36 bool orientationReversing() const;
37 friend VectorTransformation2D operator*(const VectorTransformation2D &l, const VectorTransformation2D &r);
38 static VectorTransformation2D fromFlips(bool flipH, bool flipV);
39 static VectorTransformation2D fromTranslate(double x, double y);
40 static VectorTransformation2D fromCounterRadians(double theta);
41};
42 VectorTransformation2D operator*(const VectorTransformation2D &l, const VectorTransformation2D &r);
43} // namespace libmspub
44
45#endif /* INCLUDED_VECTORTRANSFORMATION2D_H */
46/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libmspub::VectorTransformation2D
Definition VectorTransformation2D.h:26
libmspub::VectorTransformation2D::operator*
friend VectorTransformation2D operator*(const VectorTransformation2D &l, const VectorTransformation2D &r)
Definition VectorTransformation2D.cpp:24
libmspub::VectorTransformation2D::m_m11
double m_m11
Definition VectorTransformation2D.h:27
libmspub::VectorTransformation2D::m_m12
double m_m12
Definition VectorTransformation2D.h:27
libmspub::VectorTransformation2D::fromTranslate
static VectorTransformation2D fromTranslate(double x, double y)
Definition VectorTransformation2D.cpp:45
libmspub::VectorTransformation2D::m_y
double m_y
Definition VectorTransformation2D.h:28
libmspub::VectorTransformation2D::m_x
double m_x
Definition VectorTransformation2D.h:28
libmspub::VectorTransformation2D::m_m22
double m_m22
Definition VectorTransformation2D.h:27
libmspub::VectorTransformation2D::fromFlips
static VectorTransformation2D fromFlips(bool flipH, bool flipV)
Definition VectorTransformation2D.cpp:36
libmspub::VectorTransformation2D::orientationReversing
bool orientationReversing() const
Definition VectorTransformation2D.cpp:114
libmspub::VectorTransformation2D::fromCounterRadians
static VectorTransformation2D fromCounterRadians(double theta)
Definition VectorTransformation2D.cpp:55
libmspub::VectorTransformation2D::transform
Vector2D transform(Vector2D original) const
Definition VectorTransformation2D.cpp:65
libmspub::VectorTransformation2D::VectorTransformation2D
VectorTransformation2D()
Definition VectorTransformation2D.cpp:19
libmspub::VectorTransformation2D::getHorizontalScaling
double getHorizontalScaling() const
Definition VectorTransformation2D.cpp:104
libmspub::VectorTransformation2D::getVerticalScaling
double getVerticalScaling() const
Definition VectorTransformation2D.cpp:109
libmspub::VectorTransformation2D::m_m21
double m_m21
Definition VectorTransformation2D.h:27
libmspub::VectorTransformation2D::getRotation
double getRotation() const
Definition VectorTransformation2D.cpp:91
libmspub::VectorTransformation2D::transformWithOrigin
Vector2D transformWithOrigin(Vector2D v, Vector2D origin) const
Definition VectorTransformation2D.cpp:72
libmspub
Definition Arrow.h:14
libmspub::operator-
Vector2D operator-(const Vector2D &l, const Vector2D &r)
Definition VectorTransformation2D.cpp:84
libmspub::operator+
Vector2D operator+(const Vector2D &l, const Vector2D &r)
Definition VectorTransformation2D.cpp:77
libmspub::operator*
VectorTransformation2D operator*(const VectorTransformation2D &l, const VectorTransformation2D &r)
Definition VectorTransformation2D.cpp:24
libmspub::Vector2D
Definition VectorTransformation2D.h:16
libmspub::Vector2D::m_x
double m_x
Definition VectorTransformation2D.h:17
libmspub::Vector2D::Vector2D
Vector2D(double x, double y)
Definition VectorTransformation2D.h:19
libmspub::Vector2D::m_y
double m_y
Definition VectorTransformation2D.h:18