Blame src/lib/VectorTransformation2D.h

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