Pangolin
Header-only C++20 plane computational geometry library
Loading...
Searching...
No Matches
transformation.hpp File Reference

Public declaration of pgl::Transformation, an affine transformation. More...

#include "core/rational.hpp"
#include <array>
#include <cmath>
#include <concepts>
#include <type_traits>

Go to the source code of this file.

Classes

struct  pgl::Transformation< Number >
 Affine transformation stored as a 2x3 matrix. More...

Namespaces

namespace  pgl

Functions

template<class Number, class ShapeT>
requires (detail::shapeRank<ShapeT> >= 0 && !RectangleConcept<ShapeT> && !DiskConcept<ShapeT>)
constexpr auto pgl::operator* (const Transformation< Number > &transformation, const ShapeT &shape)
 Applies a transformation to any supported shape.
template<class Number, ShapeConcept ShapeT>
constexpr auto pgl::operator* (const Transformation< Number > &transformation, const ShapeT &shape)
 Applies a transformation to the polymorphic Shape wrapper.

Detailed Description

Public declaration of pgl::Transformation, an affine transformation.

Transformation stores a 2x3 matrix mapping (x,y) to (a*x+b*y+tx, c*x+d*y+ty). It is applied to a point or shape with operator* and composed with another transformation with the same operator, so t1 * t2 * shape both composes and applies left to right. Application to every shape but Rectangle and Disk is defined in implementation/transformations.hpp, once every shape is visible: a general affine map turns a rectangle into a parallelogram and a disk into an ellipse, neither of which those two classes can represent, so no such overload exists and applying one is a compile error.