# Homogeneous coordinates

Homogeneous coordinates of a real projective straight line: every straight line point including the far point is identified with a straight line through the origin of the plane and receives the components of any direction vector of this straight line as coordinates

In projective geometry , homogeneous coordinates are used to represent points in a projective space using numerical values ​​and thus to make geometrical problems accessible for computational processing. Compared to the (inhomogeneous) coordinates normally used , which uniquely identify each point, homogeneous coordinates have the property that they are not clearly determined for a given point. The advantage of homogeneous coordinates lies in the uniform representation of the elements of a projective space, in which remote elements no longer play a special role. In addition, by using homogeneous coordinates, all collineations , and thus also parallel displacements , can be uniformly described by linear images and thus by matrices . For this reason, homogeneous coordinates in three-dimensional space play an important role in computer graphics .

## Projective coordinate systems

### Homogeneous coordinates

Homogeneous coordinates of a real projective plane: are projective points ( straight line through the origin), are projective straight lines (original planes ) are the homogeneous coordinates of the point
${\ displaystyle P, Q}$
${\ displaystyle g, h}$
${\ displaystyle x_ {1}, x_ {2}, x_ {3}}$${\ displaystyle P = (x_ {1} \ colon x_ {2} \ colon x_ {3})}$

Homogeneous coordinates can best be understood using the example of the real projective plane . The projective straight line and higher-dimensional projective spaces are provided with coordinates analogously. In the homogeneous model corresponds to the real projective plane

A point then lies on a straight line if the straight line through the origin belonging to the point lies in the plane of the origin belonging to the straight line (see figure). A point of the projective plane can thus be described by any point on the associated straight line through the origin. Then you write ${\ displaystyle P}$${\ displaystyle (x_ {1}, x_ {2}, x_ {3}) \ neq (0,0,0)}$

${\ displaystyle P = (x_ {1} \ colon x_ {2} \ colon x_ {3})}$

and calls homogeneous coordinates of the point . Obviously, ${\ displaystyle x_ {1}, x_ {2}, x_ {3}}$ ${\ displaystyle P}$

${\ displaystyle (x_ {1} \ colon x_ {2} \ colon x_ {3}) = (rx_ {1} \ colon rx_ {2} \ colon rx_ {3})}$

for each number . A straight line of the projective plane is then described by a (homogeneous) plane equation . In this model, it is easy to convince oneself of the basic incidence properties of a projective plane: ${\ displaystyle r \ neq 0}$ ${\ displaystyle ax_ {1} + bx_ {2} + cx_ {3} = 0}$

• For every two different points there is exactly one connecting line that contains both points.
• Every two different straight lines have exactly one point of intersection.

### Inhomogeneous coordinates

Inhomogeneous coordinates of a real projective plane

In the inhomogeneous model of the real projective plane, one starts from the visual plane and supplements the point set with far points in such a way that every two straight lines, i.e. also parallel straight lines, intersect at exactly one point.

After the introduction of Cartesian coordinates, the far point is usually added to every straight line with the slope . The straight lines (parallels to the y-axis) receive the far point (see picture). Since two far points must be connected by a straight line, all far points are combined to form a far straight line . It is easy to check that the new incidence structure (expanded view level) fulfills the essential properties of a projective level: ${\ displaystyle y = mx + d, d \ in \ mathbb {R},}$${\ displaystyle m}$${\ displaystyle (m)}$${\ displaystyle x = c}$${\ displaystyle (\ infty)}$${\ displaystyle g _ {\ infty}}$

• Every two points have exactly one connecting line.
• Every two straight lines have exactly one point of intersection.

### Isomorphism

Relationship between inhomogeneous and homogeneous coordinates

In order to show that the homogeneous and inhomogeneous model of the real projective plane are isomorphous, the inhomogeneous model is so embedded in the three-dimensional space, that the points of view plane of the equation satisfy: . The point of the homogeneous model is thus assigned to the point of the inhomogeneous model . A point is mapped to the point whose homogeneous coordinates satisfy the equation . So one can assign the straight line through origin common to all planes of origin to the far point common to all inhomogeneous straight lines (see picture). ${\ displaystyle x_ {3} = 1}$${\ displaystyle (x, y) \ rightarrow (x, y, 1)}$${\ displaystyle (x, y)}$${\ displaystyle (x \ colon y \ colon 1)}$${\ displaystyle (x, mx + d)}$${\ displaystyle (x_ {1} \ colon x_ {2} \ colon x_ {3})}$${\ displaystyle mx_ {1} -x_ {2} + dx_ {3} = 0, x_ {3} \ neq 0,}$${\ displaystyle y = mx + d, d \ in \ mathbb {R},}$${\ displaystyle (m)}$${\ displaystyle mx_ {1} -x_ {2} + dx_ {3} = 0, d \ in \ mathbb {R},}$${\ displaystyle (1 \ colon m \ colon 0)}$

The great advantage of homogeneous coordinates compared to the clearer inhomogeneous coordinates lies in the homogeneous representation of the points and straight lines. Far points and long distance lines no longer play a special role and all collineations, including translations, can be uniformly described by linear images (matrices). The latter plays a particularly important role in computer graphics .

Summary:

${\ displaystyle (x, y) \ \ rightarrow \ (x \ colon y \ colon 1) \, \ quad (m) \ \ rightarrow \ (1 \ colon m \ colon 0) \, \ quad (\ infty) \ \ rightarrow \ (0 \ colon 1 \ colon 0) \.}$

Reversal:

${\ displaystyle (x_ {1} \ colon x_ {2} \ colon x_ {3}) \ \ rightarrow \ \ left ({\ frac {x_ {1}} {x_ {3}}}, {\ frac {x_ {2}} {x_ {3}}} \ right)}$if ${\ displaystyle x_ {3} \ neq 0 \,}$
${\ displaystyle (x_ {1} \ colon x_ {2} \ colon 0) \ \ \ rightarrow \ \ left ({\ frac {x_ {2}} {x_ {1}}} \ right)}$if ${\ displaystyle x_ {1} \ neq 0 \,}$
${\ displaystyle (0 \ colon x_ {2} \ colon 0) \ quad \ rightarrow \ (\ infty) \.}$

Assignment of the straight lines:

${\ displaystyle y = mx + d \ \ leftrightarrow \ mx_ {1} -x_ {2} + dx_ {3} = 0 \,}$
${\ displaystyle x = c \ quad \ qquad \ leftrightarrow \ x_ {1} -cx_ {3} = 0 \,}$
${\ displaystyle g _ {\ infty} \ qquad \ qquad \, \ leftrightarrow \ x_ {3} = 0 \.}$

The embedding is not presented uniformly in the literature. The homogeneous coordinates can also be designated with or the line in the distance can satisfy the equation . ${\ displaystyle (x_ {0}, x_ {1}, x_ {2})}$${\ displaystyle x_ {1} = 0}$

## general definition

Every point in a -dimensional projective space can be described by coordinates. The projective space above the body is defined as the factor space${\ displaystyle n}$${\ displaystyle n + 1}$${\ displaystyle P ^ {n} (K)}$ ${\ displaystyle K}$

${\ displaystyle P ^ {n} (K) = \ left (K ^ {n + 1} \ setminus \ {(0, \ ldots, 0) \} \ right) / \ sim}$

of the coordinate space without the zero vector with respect to the equivalence relation${\ displaystyle K ^ {n + 1}}$ ${\ displaystyle (0, \ ldots, 0)}$

${\ displaystyle (x_ {0}, \ ldots, x_ {n}) \ sim (y_ {0}, \ ldots, y_ {n}) \ Leftrightarrow (x_ {0}, \ ldots, x_ {n}) = (\ lambda y_ {0}, \ ldots, \ lambda y_ {n}) ~ {\ text {for a}} ~ \ lambda \ neq 0}$.

The homogeneous coordinates of a point in projective space are then , where any element is of the corresponding equivalence class . Homogeneous coordinates are often due to ${\ displaystyle P \ in P ^ {n} (K)}$${\ displaystyle x_ {0}, \ ldots, x_ {n}}$${\ displaystyle (x_ {0}, \ ldots, x_ {n})}$

${\ displaystyle P = \ left (x_ {0} \ colon x_ {1} \ colon \ ldots \ colon x_ {n} \ right)}$   or   ${\ displaystyle P = \ left [x_ {0} \ colon x_ {1} \ colon \ ldots \ colon x_ {n} \ right]}$

noted, whereby the colons should indicate that the representation is only unique up to multiplication with a constant.

## Projective transformations

### In two-dimensional space

In the following, examples and finally all affine mappings are initially continued in the inhomogeneous model for projectivities and then described in the homogeneous model by matrices. However, it must be ensured that the respective matrices (in the homogeneous model) are not clearly determined. Because not only the identity matrix , but every multiple (scaling matrix im ) leaves every straight line through the origin (projective point) invariant. The matrix of a projectivity can therefore be multiplied by any scaling matrix without the associated projectivity changing. ${\ displaystyle \ mathbf {E}}$${\ displaystyle r \ mathbf {E}, \; r \ in \ mathbb {R},}$${\ displaystyle \ mathbb {R} ^ {3}}$

 a): ${\ displaystyle \ quad {\ begin {matrix} (x, y) & \ to & (x + s, y + t) & \\ && {\ text {(Translation)}} \\ (m) & \ to & (m) & \ qquad \; \\ (\ infty) & \ to & (\ infty) \ end {matrix}}}$ ${\ displaystyle {\ begin {matrix} \ qquad (x_ {1} \ colon x_ {2} \ colon x_ {3}) \ \ to \ (x_ {1} + sx_ {3} \ colon x_ {2} + tx_ {3} \ colon x_ {3}) \\ {\ begin {pmatrix} 1 & 0 & s \\ 0 & 1 & t \\ 0 & 0 & 1 \ end {pmatrix}} \\ ({\ text {im}} \; \ mathbb {R} ^ {3}: {\ text {Shear at}} \; x_ {1} x_ {2} {\ text {-plane}}) \ end {matrix}}}$ b): ${\ displaystyle \ quad {\ begin {matrix} (x, y) & \ to & (x, dy) \\ && {\ text {(stretching on x-axis)}} \\ (m) & \ to & (md) \\ (\ infty) & \ to & (\ infty) \ end {matrix}}}$ ${\ displaystyle {\ begin {matrix} \ quad (x_ {1} \ colon x_ {2} \ colon x_ {3}) \ \ to \ (x_ {1} \ colon dx_ {2} \ colon x_ {3} ) \\ {\ begin {pmatrix} 1 & 0 & 0 \\ 0 & d & 0 \\ 0 & 0 & 1 \ end {pmatrix}} \\\ quad ({\ text {stretching an}} x_ {1} x_ {3} {\ text {-plane in }} \; x_ {2} {\ text {direction}}.) \ end {matrix}}}$ c): ${\ displaystyle \ quad {\ begin {matrix} (x, y) & \ to & (ax + by + s, cx + dy + t) \\ && {\ text {(any affinity)}} \\ (m ) & \ to & {\ Bigl \ {} {\ begin {matrix} ({\ frac {c + dm} {a + bm}}), & {\ text {if}} & a + bm \ neq 0 \\ (\ infty), & {\ text {falls}} & a + bm = 0 \ end {matrix}} \\ (\ infty) & \ to & {\ Bigl \ {} {\ begin {matrix} ({\ frac {d} {b}}), & {\ text {falls}} & b \ neq 0 \\ (\ infty), & {\ text {falls}} & b = 0 \ end {matrix}} \. \ end { matrix}}}$ ${\ displaystyle \ qquad {\ begin {matrix} \ qquad (x_ {1} \ colon x_ {2} \ colon x_ {3}) \ \ to \ (x '_ {1} \ colon x' _ {2} \ colon x '_ {3}) \\\ qquad {\ begin {pmatrix} x' _ {1} \\ x '_ {2} \\ x' _ {3} \ end {pmatrix}} = {\ begin {pmatrix} a & b & s \\ c & d & t \\ 0 & 0 & 1 \ end {pmatrix}} {\ begin {pmatrix} x_ {1} \\ x_ {2} \\ x_ {3} \ end {pmatrix}} \\\ end { matrix}}}$

The continuations of the affinities only provide those collineations that leave the distance line fixed as a whole. The associated matrices in the homogeneous model are characterized by the fact that they have a 0 in the third position in the first two columns. So not all matrices appear yet. But the following applies:

• Every regular 3 × 3 matrix (determinant not 0) induces a collineation of the projective plane, which is called projectivity . The set of projectivities form the group ( projective linear group ).${\ displaystyle \ operatorname {PGL} (3, \ mathbb {R})}$

E.g .: The matrix induces a projectivity which, in the inhomogeneous model, swaps the distance line with the y-axis and the point with the point . (The points are fixed points.) So it is not a continuation of an affinity. ${\ displaystyle {\ begin {pmatrix} 0 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 0 & 0 \ end {pmatrix}}}$${\ displaystyle g _ {\ infty}}$${\ displaystyle (x, y)}$${\ displaystyle ({\ tfrac {1} {x}}, {\ tfrac {y} {x}})}$${\ displaystyle (-1,0), (1, y)}$

If one wants to represent any projectivity in the inhomogeneous model, this is only possible with broken linear expressions. This shows the strength of the homogeneous model. It gets by with linear expressions.

### In three-dimensional space

Similar to the plane case, homogeneous coordinates can also be introduced in 3-dimensional projective space. There are then 4 homogeneous coordinates and the mapping matrices of the projectivities are 4 × 4 matrices. In computer graphics, not only transformations of space in homogeneous coordinates are represented by 4 × 4 matrices, but also projections of space onto a plane (see graphics pipeline ). Since the dimension is reduced in such projections (from 3 to 2), the associated matrices have the determinant 0. Here are two examples of projection matrices:

The first matrix describes the central projection from the eye point onto the xy plane. The second matrix effects an orthogonal projection onto the xy plane. ${\ displaystyle (0,0, d), d \ neq 0,}$

 Central projection : ${\ displaystyle \ mathbf {P _ {\ mathrm {zp}}}}$ = ${\ displaystyle {\ begin {pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & - {\ frac {1} {d}} & 1 \ end {pmatrix}} \,}$ ${\ displaystyle \ mathbf {P _ {\ mathrm {zp}}} \; (x, y, z, 1) ^ {T} = (x, y, 0, {\ tfrac {dz} {d}}) ^ {T}}$ Orthogonal projection : ${\ displaystyle \ mathbf {P _ {\ mathrm {op}}}}$ = ${\ displaystyle {\ begin {pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \ end {pmatrix}} \,}$ ${\ displaystyle \ mathbf {P _ {\ mathrm {op}}} \; (x, y, z, 1) ^ {T} = (x, y, 0,1) ^ {T}}$

## Applications

Rational Bézier curve in homogeneous coordinates (blue) and its projection into the plane (red)

Homogeneous coordinates are used within geometry

In computer graphics , homogeneous coordinates are used to

• Perform transformations of objects,
• introduce and investigate rational Bezier and B-spline curves and surfaces.

In robotics , consecutive axes can be described by linking their associated homogeneous matrices. The Denavit-Hartenberg transformation is used as the standard procedure for this .

## literature

• Albrecht Beutelspacher , Ute Rosenbaum: Projective geometry. 2nd Edition. Vieweg, Wiesbaden 2004, ISBN 3-528-17241-X , p. 63.
• G. Farin: Curves and Surfaces for CAGD , Academic Press, 1990, ISBN 0-12-249051-7 , p. 217
• CE Springer: Geometry and Analysis of Projective Spaces . San Francisco and London, 1964.
• Frank Klawonn: Basic course computer graphics with Java. Understand the basics and easily implement them with Java 3D. 3. Edition. Vieweg + Teubner, Wiesbaden 2010, ISBN 978-3-8348-1223-0 .