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