struct CCL::Transform

Overview

2D Transformation Matrix More…

#include <transform.h>

struct Transform
{
    // fields

    float a0;
    float a1;
    float b0;
    float b1;
    float t0;
    float t1;

    // construction

    Transform ();
    Transform (float a0, float a1, float b0, float b1, float t0, float t1);

    // methods

    Transform& operator () (
        float a0,
        float a1,
        float b0,
        float b1,
        float t0,
        float t1
    );

    Transform& operator = (const Transform& t);
    bool operator == (TransformRef other) const;
    bool operator != (TransformRef other) const;
    bool isIdentity () const;
    Transform& translate (float tx, float ty);
    Transform& scale (float sx, float sy);
    Transform& rotate (float angle);
    Transform& skewX (float angle);
    Transform& skewY (float angle);
    Transform& multiply (const Transform& t);

    template  <class TCoord>
    Core::TPoint <TCoord>& transform (Core::TPoint <TCoord>& p) const;

    template  <class TCoord>
    Core::TRect <TCoord>& transform (Core::TRect <TCoord>& r) const;

    template  <class TCoord>
    TPoint <TCoord>& transform (TPoint <TCoord>& p) const;

    template  <class TCoord>
    TRect <TCoord>& transform (TRect <TCoord>& r) const;
};

Detailed Documentation

2D Transformation Matrix

Construction

Transform ()

Construct with identity matrix.

Transform (float a0, float a1, float b0, float b1, float t0, float t1)

Construct matrix.

Methods

Transform& operator () (
    float a0,
    float a1,
    float b0,
    float b1,
    float t0,
    float t1
)

Assign matrix.

Transform& operator = (const Transform& t)

Assign matrix.

bool operator == (TransformRef other) const

Comparison operator.

bool operator != (TransformRef other) const

Comparison operator.

bool isIdentity () const

Check if this is an identity matrix.

Transform& translate (float tx, float ty)

Translate matrix.

Transform& scale (float sx, float sy)

Scale matrix.

Transform& rotate (float angle)

Rotate matrix.

Transform& skewX (float angle)

Skew matrix horizontally.

Transform& skewY (float angle)

Skew matrix vertically.

Transform& multiply (const Transform& t)

Multiply with other matrix.

template  <class TCoord>
Core::TPoint <TCoord>& transform (Core::TPoint <TCoord>& p) const

Transform point.

template  <class TCoord>
Core::TRect <TCoord>& transform (Core::TRect <TCoord>& r) const

Transform rectangle (bounding box of resulting parallelogram).