QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
ShapeTransform Struct Reference

The ShapeTransform struct Rotation, skew and scale applied to a shape's local geometry around an arbitrary local pivot point. More...

#include <shapetransform.h>

Collaboration diagram for ShapeTransform:
Collaboration graph

Public Member Functions

bool isIdentity () const
QTransform linearPart () const
QTransform toMatrix () const
bool operator== (const ShapeTransform &other) const
bool operator!= (const ShapeTransform &other) const

Public Attributes

qreal rotation = 0
qreal skewX = 0
qreal skewY = 0
qreal scaleX = 1
qreal scaleY = 1
QPointF pivot

Detailed Description

The ShapeTransform struct Rotation, skew and scale applied to a shape's local geometry around an arbitrary local pivot point.

These five scalars plus a pivot are a convenient, directly-editable basis for 2D affine transforms: every handle in the UI changes exactly one field, which is what makes per-handle drag math simple. Note that a plain 2x2 linear map only has 4 true degrees of freedom, one fewer than (rotation, skewX, skewY, scaleX, scaleY) – so this is not a unique* representation of a matrix, only a convenient one. That redundancy is harmless for editing (nothing here ever needs to invert the forward direction) and only matters to decomposeLinear() below, which exists for later consumers (flattening a group transform onto its children, importing a foreign matrix) rather than everyday use.

The resulting matrix is meant to be handed directly to QGraphicsItem::setTransform(). QGraphicsItem::transformOriginPoint() is deliberately NOT used anywhere in this design: it only centers QGraphicsItem's own rotation()/scale() convenience properties, and has no effect on a custom transform() matrix – the pivot has to be baked into the matrix itself, as toMatrix() does. QGraphicsItem::pos() supplies the translation on top, unchanged from how shapes are already positioned and moved today.

Member Function Documentation

◆ isIdentity()

bool ShapeTransform::isIdentity ( ) const

◆ linearPart()

QTransform ShapeTransform::linearPart ( ) const
Here is the caller graph for this function:

◆ operator!=()

bool ShapeTransform::operator!= ( const ShapeTransform & other) const
inline

◆ operator==()

bool ShapeTransform::operator== ( const ShapeTransform & other) const

◆ toMatrix()

QTransform ShapeTransform::toMatrix ( ) const

Member Data Documentation

◆ pivot

QPointF ShapeTransform::pivot

◆ rotation

qreal ShapeTransform::rotation = 0

◆ scaleX

qreal ShapeTransform::scaleX = 1

◆ scaleY

qreal ShapeTransform::scaleY = 1

◆ skewX

qreal ShapeTransform::skewX = 0

◆ skewY

qreal ShapeTransform::skewY = 0

The documentation for this struct was generated from the following files: