# Coordinate transformation

Coordinate transformation for an object assumed to be stationary (left) or a coordinate system assumed to be stationary (right)

With a coordinate transformation , the coordinates of a point in one coordinate system are calculated from the coordinates in another coordinate system. From a formal point of view, this is the conversion (transformation) of the original coordinates into the new coordinates . The most common applications are found in geometry , geodesy , image measurement and technical tasks, but also in such popular areas as computer animation or computer games , in which the "reality" shown from the perspective of the player (as a moving coordinate system) is continuous must be recalculated. ${\ displaystyle (x_ {1}, x_ {2}, \ dotsc, x_ {n})}$${\ displaystyle (x '_ {1}, x' _ {2}, \ dotsc, x '_ {n})}$

Typical coordinate transformations result from rotation (rotation), scaling (changing the scale), shear and shifting (translation) of the coordinate system, which can also be combined.

In general, the new coordinates can be any functions of the old coordinates . As a rule, special transformations are used where these functions have certain restrictions - e.g. B. Differentiability, linearity or form fidelity - subject. Coordinate transformations can be used when a problem is easier to solve in another coordinate system, e.g. B. when transforming Cartesian coordinates into spherical coordinates or vice versa. ${\ displaystyle x '_ {i}}$${\ displaystyle x_ {i}}$

A special case of coordinate transformation is the change of base in a vector space.

The transformations considered here, in which the coordinate systems are changed and only the coordinates of the points change while the points themselves remain unchanged, are also called passive or alias transformations, while transformations in which the position of the points is reversed relative to a fixed one Coordinate system changes, also called active or alibi transformations (see Fig.).

## Linear transformations

In the case of linear transformations, the new coordinates are linear functions of the original ones, i.e.

${\ displaystyle x '_ {1} = a_ {11} x_ {1} + a_ {12} x_ {2} + \ dots + a_ {1n} x_ {n}}$
${\ displaystyle x '_ {2} = a_ {21} x_ {1} + a_ {22} x_ {2} + \ dots + a_ {2n} x_ {n}}$
${\ displaystyle \ ldots}$
${\ displaystyle x '_ {n} = a_ {n1} x_ {1} + a_ {n2} x_ {2} + \ dots + a_ {nn} x_ {n}}$.

This can be represented in compact form as a matrix multiplication of the old coordinate vector with the matrix that contains the coefficients${\ displaystyle {\ vec {x}} = (x_ {1}, \ dots, x_ {n})}$ ${\ displaystyle A}$${\ displaystyle a_ {ij}}$

${\ displaystyle {\ vec {x}} '= A {\ vec {x}}}$.

The origin of the new coordinate system agrees with that of the original coordinate system.

### Rotation

Rotation of a coordinate system with respect to a vector considered to be at rest and of a vector with respect to a coordinate system considered to be at rest
Rotation of the coordinate system counterclockwise

An important type of linear coordinate transformations are those in which the new coordinate system is rotated around the origin of the coordinates compared to the old one (the so-called "alias transformation" in the graphic opposite). In two dimensions there is only the angle of rotation as a parameter, in the three-dimensional, however, an axis of rotation that does not change due to the rotation must also be defined. In both cases, the rotation is described by a rotation matrix .

#### example

Consider two-dimensional Cartesian coordinate systems and having a common z-axis and a common origin. Let the coordinate system be rotated by the angle around the z-axis. A point P, which has the coordinates in the coordinate system S , then has the coordinates in the coordinate system S ' with: ${\ displaystyle S}$${\ displaystyle S '}$${\ displaystyle S '}$${\ displaystyle S}$${\ displaystyle \ varphi}$${\ displaystyle {\ vec {x}} = (x, y, z)}$${\ displaystyle {\ vec {x}} '= (x', y ', z')}$

${\ displaystyle x '= x \ cos \ varphi + y \ sin \ varphi,}$
${\ displaystyle y '= - x \ sin \ varphi + y \ cos \ varphi,}$
${\ displaystyle z '= z.}$

In matrix notation, the inverse rotation matrix for this rotation of the coordinate system results:

${\ displaystyle {\ vec {x}} '= {\ begin {pmatrix} \ cos \ varphi & \ sin \ varphi & 0 \\ - \ sin \ varphi & \ cos \ varphi & 0 \\ 0 & 0 & 1 \ end {pmatrix}} {\ vec {x}}.}$

### Scaling

Scaling

When scaling , the "units" of the axes are changed. This means that the numerical values ​​of the coordinates are multiplied by constant factors ("scaled") ${\ displaystyle x_ {i}}$${\ displaystyle \ lambda _ {i}}$

${\ displaystyle x_ {i} '= \ lambda _ {i} \ cdot x_ {i}.}$

The parameters of this transformation are the numbers . A special case is the “change of scale” in which all factors have the same value ${\ displaystyle N}$${\ displaystyle \ lambda _ {i}}$

${\ displaystyle \ lambda _ {i} = \ lambda.}$

The matrix in this case is -fold the identity matrix . ${\ displaystyle A}$${\ displaystyle \ lambda}$

### Shear

Shear

The angle between the coordinate axes changes during shear . There is therefore one parameter in two dimensions and three parameters in three-dimensional space.

## Affine transformations

Affine transformations consist of a linear transformation and a translation.

If both coordinate systems involved are linear (i.e. in principle given by a coordinate origin and uniformly subdivided coordinate axes), then there is an affine transformation. Here the new coordinates are affine functions of the original ones , ie

${\ displaystyle x '_ {1} = a_ {11} x_ {1} + a_ {12} x_ {2} + \ dots + a_ {1n} x_ {n} + b_ {1}}$
${\ displaystyle x '_ {2} = a_ {21} x_ {1} + a_ {22} x_ {2} + \ dots + a_ {2n} x_ {n} + b_ {2}}$
${\ displaystyle \ ldots}$
${\ displaystyle x '_ {n} = a_ {n1} x_ {1} + a_ {n2} x_ {2} + \ dots + a_ {nn} x_ {n} + b_ {n}}$

This can be represented in compact form as a matrix multiplication of the old coordinate vector by the matrix that contains the coefficients and addition of a vector that contains them ${\ displaystyle {\ vec {x}} = (x_ {1}, \ dots, x_ {n})}$ ${\ displaystyle A}$${\ displaystyle a_ {ij}}$ ${\ displaystyle {\ vec {b}}}$${\ displaystyle b_ {i}}$

${\ displaystyle {\ vec {x}} \, '= A {\ vec {x}} + {\ vec {b}}}$

The translation is a special case of an affine transformation, where A is the identity matrix.

### Translation

shift

Two coordinate systems and are considered . The system is shifted in relation to the vector . A point that has the coordinates in the coordinate system then has the coordinates in  the coordinate system . ${\ displaystyle S}$${\ displaystyle S '}$${\ displaystyle S '}$${\ displaystyle S}$${\ displaystyle {\ vec {b}}}$${\ displaystyle P}$${\ displaystyle S}$${\ displaystyle {\ vec {x}}}$${\ displaystyle S '}$${\ displaystyle {\ vec {x}} '= {\ vec {x}} - {\ vec {b}}}$

## Examples

### Cartesian coordinates and polar coordinates

A point in the plane is determined in the Cartesian coordinate system by its coordinates (x, y) and in the polar coordinate system by the distance from the origin and the (positive) angle to the x-axis. ${\ displaystyle r}$${\ displaystyle {} \ varphi}$

The following applies to the conversion of polar coordinates into Cartesian coordinates:

• ${\ displaystyle x = r \ cdot \ cos \ varphi}$
• ${\ displaystyle y = r \ cdot \ sin \ varphi}$

The following applies to the conversion of Cartesian coordinates into polar coordinates:

• ${\ displaystyle r = {\ sqrt {x ^ {2} + y ^ {2}}}}$
• ${\ displaystyle \ varphi = {\ begin {cases} \ arctan {\ frac {y} {x}} & \ mathrm {f {\ ddot {u}} r} \ x> 0 \\\ arctan {\ frac { y} {x}} + \ pi & \ mathrm {f {\ ddot {u}} r} \ x <0, \, y \ geq 0 \\\ arctan {\ frac {y} {x}} - \ pi & \ mathrm {f {\ ddot {u}} r} \ x <0, \, y <0 \\\ pi / 2 & \ mathrm {f {\ ddot {u}} r} \ x = 0, \ , y> 0 \\ - \ pi / 2 & \ mathrm {f {\ ddot {u}} r} \ x = 0, \, y <0 \ end {cases}}}$
${\ displaystyle {} = {\ begin {cases} \ arccos {\ frac {x} {r}} & \ mathrm {f {\ ddot {u}} r} \ y \ geq 0 \\ - \ arccos \ left ({\ frac {x} {r}} \ right) & \ mathrm {f {\ ddot {u}} r} \ y <0 \ end {cases}}}$

When implementing the variant with , rounding errors are to be expected, which are significantly lower when using the . ${\ displaystyle arccos}$${\ displaystyle arctan}$

### Other uses

In physics , the invariance of certain natural laws plays a special role under coordinate transformations, see symmetry transformation . The Galileo transformation , Lorentz transformation and the gauge transformation are of particularly fundamental importance . Transformations of operators and vectors are also frequently used:

In the geosciences - especially geodesy and cartography - there are other transformations that formally represent coordinate transformations.

In the field of robotics , the Denavit-Hartenberg transformation is the standard procedure.