# Affine transformation¶

This modifier applies an affine transformation to the system. It may be used to translate, scale, rotate or shear the particles, the simulation cell and/or other elements. The transformation can either be specified explicitly in terms of a 3x3 matrix plus a translation vector, or implicitly by prescribing a fixed shape for the final simulation cell.

Given a 3x3 linear transformation matrix $$\mathbf{M}$$ and a translation vector $$\mathbf{t}$$, which together describe a general affine transformation, the transformed position of a particle at the original position $$\mathbf{x}$$ is computed as $$\mathbf{x}' = \mathbf{M} \cdot \mathbf{x} + \mathbf{t}$$. This notation uses column vectors.

The button Enter rotation opens a dialog box which lets you specify a rotation axis, a rotation angle and a center of rotation. Based on these inputs, OVITO computes the corresponding affine transformation for you.

## Transform to target box¶

The Transform to target box option lets the modifier dynamically compute the affine transformation based the original shape of the simulation cell and a specified target cell shape. The automatically determined transformation maps the existing simulation cell exactly onto the given target cell shape. All contents of the simulation cell (e.g. particles, surface meshes, etc.) will be mapped into the new cell shape accordingly, unless you turn off their transformation (see next section).

Note that you can use this option to replace a varying simulation cell loaded from the input trajectory file(s) with a constant simulation cell shape of your choice.

## Transformed elements¶

You can select the types of data elements that should get transformed by the modifier:

Element type

Description

Particles

Applies the affine transformation to the coordinates of particles (i.e. the Position particle property).

Vector particle properties

Applies the linear part $$\mathbf{M}$$ of the affine transformation to the Velocity, Force and Displacement particle properties.

Simulation cell

Applies the affine transformation to the origin of the simulation cell and the linear part to the three cell vectors.

Surfaces

Applies the affine transformation to the vertices of surface meshes and triangle meshes.

Voxel grids

Applies the affine transformation to the domain shape of a voxel grid.

Dislocations

Applies the affine transformation to a set of dislocation lines.

The option Transform selected elements only restricts the application of the transformation to the currently selected particles.