Raster affine transformation
This page explains the basic concepts of Affine Transformation in Sedona Raster.
Affine Transformations¶
Affine transformations are a fundamental concept in computer graphics, geometry, and image processing that involve manipulating an object in a way that preserves lines and parallelism (but not necessarily distances and angles). These transformations are linear transformations followed by a translation, which means they can translate, scale, rotate, and shear objects without altering the relative arrangement of points, lines, or planes.
Components of Affine Transformations¶
Affine transformations can be represented as a matrix operation. In twodimensional space, a typical affine transformation matrix is a 3x3 matrix as follows:
 ScaleX SkewX TranslationX 
 SkewY ScaleY TranslationY 
 0 0 1 
Here, ScaleX, ScaleY, SkewX, SkewY, TranslationX,
and TranslationY
are parameters that define the transformation:
ScaleX
andScaleY
are scaling factors for the x and y axes, respectively.SkewX
andSkewY
introduce shearing and are responsible for "skewing" the shape.TranslationX
andTranslationY
are translation parameters that move the shape in the x and y directions, respectively.
Types of Affine Transformations¶

Translation: Moves every point of a figure or space by the same distance in a given direction. This primarily affects the
TranslationX
andTranslationY
components. 
Scaling: Multiplies the coordinates of each point by a constant (ScaleX for xaxis and ScaleY for yaxis), enlarging or reducing its size. Scaling can be uniform (the same factor for both axes) or nonuniform (different factors for each axis).

Rotation: Rotates the object about a point (usually the origin or a specified point). This can be expressed through combinations of
ScaleX, ScaleY, SkewX,
andSkewY
where these parameters are derived from the cosine and sine of the rotation angle. 
Shearing: Transforms parallel lines to still be parallel but moves them so that they are no longer perpendicular to their original orientations. This affects the
SkewX
andSkewY
components. 
Reflection: Flips the object over a specified axis, which can be achieved by combining scaling and rotation.
Mathematical Properties¶
 Collinearity and Concurrency: Affine transformations preserve points on a line (collinearity) and the intersection of lines (concurrency).
 Ratios of Segments: They also preserve the ratios of distances between points lying on a straight line.
Components of Affine Transformations¶
In affine transformations, which are integral to manipulating graphics, images, and geometric data, the terms ScaleX, ScaleY, SkewX, and SkewY refer to specific types of transformations that alter the shape and position of objects:
ScaleX and ScaleY¶

ScaleX: This parameter represents the scaling factor along the xaxis. It modifies the width of an image or object. Values greater than 1 increase the width, values less than 1 decrease it, and negative values reflect the object along the xaxis while scaling.

ScaleY: This parameter represents the scaling factor along the yaxis. It affects the height of the object. Similarly to ScaleX, values greater than 1 enlarge the object vertically, values less than 1 reduce it, and negative values invert it along the yaxis.
SkewX and SkewY¶

SkewX: This parameter is used to skew or shear the object along the xaxis. It shifts each point's xcoordinate in proportion to its ycoordinate, creating a slanting effect. This transformation is useful for creating the illusion of depth or perspective in 2D representations.

SkewY: Corresponding to SkewX, SkewY skews the object along the yaxis. It alters each point's ycoordinate relative to its xcoordinate, which also creates a slanting effect, but in the vertical direction.
These transformations are typically used together in a transformation matrix, which allows them to be applied to objects in a combined and coherent way. Here's a typical representation of such a matrix:
 ScaleX SkewX TranslationX 
 SkewY ScaleY TranslationY 
 0 0 1 
These parameters can be combined in various ways to perform complex transformations such as rotations, translations, scaling, and shearing of images or shapes in both 2D and 3D graphics applications.