VectorTransformation2D.h
Go to the documentation of this file.
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* This file is part of the libmspub project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_VECTORTRANSFORMATION2D_H
#define INCLUDED_VECTORTRANSFORMATION2D_H
namespace libmspub
{
struct Vector2D
{
double m_x;
double m_y;
Vector2D(double x, double y) : m_x(x), m_y(y)
{
}
};
Vector2D operator+(const Vector2D &l, const Vector2D &r);
Vector2D operator-(const Vector2D &l, const Vector2D &r);
class VectorTransformation2D
{
double m_m11, m_m12, m_m21, m_m22;
double m_x, m_y;
public:
VectorTransformation2D();
Vector2D transform(Vector2D original) const;
Vector2D transformWithOrigin(Vector2D v, Vector2D origin) const;
double getRotation() const;
double getHorizontalScaling() const;
double getVerticalScaling() const;
bool orientationReversing() const;
friend VectorTransformation2D operator*(const VectorTransformation2D &l, const VectorTransformation2D &r);
static VectorTransformation2D fromFlips(bool flipH, bool flipV);
static VectorTransformation2D fromTranslate(double x, double y);
static VectorTransformation2D fromCounterRadians(double theta);
};
VectorTransformation2D operator*(const VectorTransformation2D &l, const VectorTransformation2D &r);
} // namespace libmspub
#endif /* INCLUDED_VECTORTRANSFORMATION2D_H */
/* 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