Homogeneous coordinates

In mathematical, the homogeneous coordinated , introduced by August Ferdinand Möbius, make calculations possible in the projective Espace as the Cartesian coordinated do it in the Euclidean Espace. The homogeneous coordinates are largely used in Infographie and more particularly for the representation of scenes in three dimensions (3D) because they are adapted to the projective Géométrie and they make it possible to characterize the Transformation S of space. The notation in matric form is more particularly employed in the libraries of three-dimensional chart programming such as OpenGL and Direct3D.

First notations and interpretations

The homogeneous coordinates of a point of the projective space of dimension N are usually written like ( X : there : Z : …: W ), a vector length n+1 , other that (0: 0: 0: …: 0). Two whole of coordinates which are proportional indicates the same point of projective space: for any scalar not-no one C taken basic body K , ( cx : cy : cz : …: CW ) is equivalent to ( X , there , Z , W ). Thus, this frame of reference introduced of the classes of equivalences made up of vectors colinéaires. Taking the example of the projective space of dimension three, the homogeneous coordinates will be ( X : there : Z : W ).

Built projective space makes it possible to characterize the Plan ad infinitum . This one is in general defined by the whole of the points or vectors having for last coordinate W = 0 . Out of this plan we can use ( x/w , y/w , z/w ) like an ordinary Cartesian system; thus space refines complementary to the plan ad infinitum is coordinated in a familiar form, with a base corresponding to (1: 0: 0: 1), (0: 1: 0: 1), (0: 0: 1: 1).

If we try to make the intersection of two plans defined by the equations X = W and X = 2w then we will derive initially W = 0 and then X = 0 . That will indicate to us that the intersection is contained in the plan ad infinitum and consists of all the points with coordinates (0: there : Z : 0). It is a line and makes of it the line uniting (0: 1: 0: 0) and (0: 0: 1: 0). The line is given by the equation: (0: there: Z: 0) = \ driven (1 - \ lambda) (0: 1: 0: 0) + \ driven \ lambda (0: 0: 1: 0) where µ is a scalar factor. This last can be adjusted for to standardize coordinated (the 0: there : Z : 0), therefore eliminating one from the two degrees of freedom. The result is a whole of points with only one degree of freedom as that is awaited from a line.

Linear combinations of vectors described with the homogeneous coordinates

Let us take a pair of vectors has and B in a projective space in three dimensions, therefore the homogeneous coordinates are

\ mathbf {has}: (X_A: Y_A: Z_A: W_A),
\ mathbf {B}: (X_B: Y_B: Z_B: W_B).
One wishes to find to them linear Combinaison has \ mathbf {has} + B \ mathbf {B} where has and B is coefficients which can be adjusted at will. There are three cases to consider:
  • the two vectors depend on a 3-space refines,
  • the two vectors are infinite,
  • a vector is closely connected and the other is infinite.

The coordinates X , Y , and Z can be regarded as Numérateur S, W like a Dénominateur. To add homogeneous coordinates it is necessary that the denominator is common. Otherwise it is necessary of redimensioner the coordinates until all the denominators are common.

The two points are closely connected

If each of the two vectors are in a 3-space closely connected, then W_A \ 0 and W_B \ 0 . Their linear combination is

has (X_A: Y_A: Z_A: W_A) + B (X_B: Y_B: Z_B: W_B) \
= (has X_A: Y_A has: Z_A has: W_A) + (B X_B: B Y_B: B Z_B: W_B) \
= \ left (has {X_A \ over W_A}: {Y_A \ over W_A} has: {Z_A \ over W_A} has: 1 \ right) + \ left (B {X_B \ over W_B}: B {Y_B \ over W_B}: B {Z_B \ over W_B}: 1 \ right)
= \ left (has {X_A \ over W_A} + B {X_B \ over W_B}: {Y_A \ over W_A} + B {Y_B \ over W_B} has: {Z_A \ over W_A} + B {Z_B \ over W_B} has: 1 \ right).

The two vectors are infinite

If each of the two vectors is infinite, then W_A = 0 and W_B = 0 . Their linear combination is

has (X_A: Y_A: Z_A: W_A) + B (X_B: Y_B: Z_B: W_B) = (has X_A: Y_A has: Z_A has: 0) + (B X_B: B Y_B: B Z_B: 0)
= (has X_A + B X_B: Y_A has + B Y_B: Z_A has + B Z_B: 0).

We obtain another infinite vector.

A vector is closely connected and the other is infinite

The first vector is in a 3-space closely connected, therefore W_A \ 0 . Then

has (X_A: Y_A: Z_A: W_A) + B (X_B: Y_B: Z_B: 0)
= has (0: 0: 0: 0) + B (X_B: Y_B: Z_B: 0),
= (B X_B: B Y_B: B Z_B: 0),

We thus obtain an infinite vector colinéaire with the infinite vector of the linear combination are equivalent to this last. This means that vector ad infinitum is “dominating”, in set theory one says that it is a element absorbing.

Matric notation

A point M of space can be, if W=1, indicated by its homogeneous coordinates in 3D in the form (X: Y: Z: 1) . The homogeneous coordinates are then used to apply Transformation S to a point 3D such as the changes of reference mark, the Rotation S, the translation S, the Homothety S, the projection S as well as the compositions of these various core operators. These transformations are then represented in the form of a Matrice (mathematics) of size 4 \ times4. We now will see how these core operators are expressed.

Translations

The matrix representing a translation in space written in the shape of a vector (t_x: t_y: t_z) is in the form:
\ left \begin{matrix} 1 & 0 & 0 & t_x \ \ 0 & 1 & 0 & t_y \ \ 0 & 0 & 1 & t_z \ \ 0 & 0 & 0 & 1 \end{matrix} \ right]
Indeed, if one calculates the coordinates of the point M' coordinates (sX': sY': sZ': S) which is the image of M by the quoted translation, we apply the following matric multiplication:
\ left \begin{matrix} sX' \ \ sY' \ \ sZ' \ \ S \end{matrix} \ right]

\ left \begin{matrix} 1 & 0 & 0 & t_x \ \ 0 & 1 & 0 & t_y \ \ 0 & 0 & 1 & t_z \ \ 0 & 0 & 0 & 1 \end{matrix} \ right] \ left \begin{matrix} X \ \ Y \ \ Z \ \ 1 \end{matrix} \ right] What gives us well: \ begin {boxes} X' = t_x + X \ \ Y' = t_y + Y \ \ Z' = t_z + Z \ \ S = 1 \ end {boxes}

To calculate a vector

\ left ( \begin{matrix} 1 & 0 & 0 & t_x \ \ 0 & 1 & 0 & t_y \ \ 0 & 0 & 1 & t_z \ \ 0 & 0 & 0 & 1 \end{matrix} \ right) \ left ( \begin{matrix} X \ \ Y \ \ Z \ \ W \end{matrix} \ right)

\ left (

\begin{matrix} kX' \\ kY' \\ kZ'\\ kW' \end{matrix} \ right)
Reciprocally, is it possible to know a vector starting from its origin and of its end, presumedly closely connected? The answer is the following one: --> Are two points, called origin O and end E, homogeneous coordinates (X_o: Y_o: Z_o: W_o) and (X_e: Y_e: Z_e: W_e) , W not being null since the points are closely connected, then the “true vector” of the plan closely connected of dimension 3 which makes it possible to relocate point O at the point E has as coordinates: \ left ( \begin{matrix} \ frac {X_e} {W_e} - \ frac {X_o} {W_o} \ \ \ frac {Y_e} {W_e} - \ frac {Y_o} {W_o} \ \ \ frac {Z_e} {W_e} - \ frac {Z_o} {W_o} \end{matrix} \ right) .

Checking : The matric equation of the translation applied to the point O correspondent with this vector is written
\ left ( \begin{matrix} 1 & 0 & 0 & \ frac {X_e} {W_e} - \ frac {X_o} {W_o} \ \ 0 & 1 & 0 & \ frac {Y_e} {W_e} - \ frac {Y_o} {W_o} \ \ 0 & 0 & 1 & \ frac {Z_e} {W_e} - \ frac {Z_o} {W_o} \ \ 0 & 0 & 0 & 1 \end{matrix} \ right) \ left ( \begin{matrix} X_o \\ Y_o \\ Z_o \\ W_o \end{matrix} \ right)

\ left ( \begin{matrix} X_o+W_o (\ frac {X_e} {W_e} - \ frac {X_o} {W_o}) \ \ Y_o+W_o (\ frac {Y_e} {W_e} - \ frac {Y_o} {W_o}) \ \ Z_o+W_o (\ frac {Z_e} {W_e} - \ frac {Z_o} {W_o}) \ \ W_o \end{matrix} \ right)

\ left (

\begin{matrix} X_e (\ frac {W_o} {W_e}) \ \ Y_e (\ frac {W_o} {W_e}) \ \ Z_e (\ frac {W_o} {W_e}) \ \ W_o \end{matrix} \ right) \ equiv \ left ( \begin{matrix} \ frac {X_e} {W_e} \ \ \ frac {Y_e} {W_e} \ \ \ frac {Z_e} {W_e} \ \ 1 \end{matrix} \ right) \ equiv \ left ( \begin{matrix} X_e \\ Y_e\\ Z_e\\ W_e \end{matrix} \ right)

The translation applied enables us to find the point of E end vector.

Relation of Chasles

The Relation of Chasles is of an immediate reading in this form:
\ left (
\begin{matrix} \ frac {X_b} {W_b} - \ frac {X_a} {W_a} \ \ \ frac {Y_b} {W_b} - \ frac {Y_a} {W_a} \ \ \ frac {Z_b} {W_b} - \ frac {Z_a} {W_a} \end{matrix} \ right) + \ left ( \begin{matrix} \ frac {X_c} {W_c} - \ frac {X_b} {W_b} \ \ \ frac {Y_c} {W_c} - \ frac {Y_b} {W_b} \ \ \ frac {Z_c} {W_c} - \ frac {Z_b} {W_b} \end{matrix} \ right) = \ left ( \begin{matrix} \ frac {X_c} {W_c} - \ frac {X_a} {W_a} \ \ \ frac {Y_c} {W_c} - \ frac {Y_a} {W_a} \ \ \ frac {Z_c} {W_c} - \ frac {Z_a} {W_a} \end{matrix} \ right) .

In the same way, with this notation, if one considers four points has, B, C and D, the Commutativité of the addition of the vectors and the theorem of the crossing of the équipollence S are obvious.

Rotations

A representation in space can be also noted in matric form. The operator will be form: \ left \begin{matrix} R_ {3 \ times3} & 0_ {3 \ times1} \ \ 0_ {1 \ times3} & 1 \end{matrix} \ right]
R_ {3 \ times3} indicates a matrix of rotation here such as it is usually defined in space. If one takes a reference mark of space (O, \ vec {I}, \ vec {J}, \ vec {K}) , we obtain following rotations around the main axes:
Rotation of angle α around \ vec {I} : \ left \begin{matrix} 1 & 0 & 0 & 0 \ \ 0 & \ cos (\ alpha) & - \ sin (\ alpha) & 0 \ \ 0 & \ sin (\ alpha) & \ cos (\ alpha) & 0 \ \ 0 & 0 & 0 & 1 \end{matrix} \ right]
Rotation of angle \ beta around \ vec {J} : \ left \begin{matrix} \ cos (\ beta) & 0 & \ sin (\ beta) & 0 \ \ 0 & 1 & 0 & 0 \ \ - \ sin (\ beta) & 0 & \ cos (\ beta) & 0 \ \ 0 & 0 & 0 & 1 \end{matrix} \ right]

Rotation of angle \ gamma around \ vec {K} : \ left \begin{matrix} \ cos (\ gamma) & - \ sin (\ gamma) & 0 & 0 \ \ \ sin (\ gamma) & \ cos (\ gamma) & 0 & 0 \ \ 0 & 0 & 1 & 0 \ \ 0 & 0 & 0 & 1 \end{matrix} \ right]

Homotheties

A homothety will be represented by the matrix: \ left \begin{matrix} h_x & 0 & 0 & 0 \ \ 0 & h_y & 0 & 0 \ \ 0 & 0 & h_z & 0 \ \ 0 & 0 & 0 & 1 \end{matrix} \ right]
If the scale factors h_x, h_y and h_z are equal then it acts of a homothety in a strict sense of the term. This formalization makes it possible to apply different scale factor according to various directions from space (anisotropic dilation).

Projections

There exist various formulations of projections, according to the type of projection considered. We will see here only the most current formulations met in Infographie 3D.

Perspective projection

We will take here the case of a projection on a plan (\ vec {I}, \ vec {J}) located at a distance f of the origin according to the direction \ vec {K} . The projected points are here on the line passing by the origin and the point to be projected. The matrix is then expressed in the following form:
\ left \begin{matrix} 1 & 0 & 0 & 0 \ \ 0 & 1 & 0 & 0 \ \ 0 & 0 & 1 & 0 \ \ 0 & 0 & 1/f & 0 \end{matrix} \ right]
Indeed, if one calculates the coordinates of the point projected M' of coordinates (sX': sY': sZ': s1) which is the image of M by quoted projection, we obtain:
\ begin {boxes} sX' = X \ \ sY' = Y \ \ sZ' = Z \ \ S = Z/f \ end {boxes} what gives, after standardization of the coordinates: \ begin {boxes} X' = fX/Z \ \ Y' = fY/Z \ \ Z' = F \ \ \ end {boxes}
This is in conformity since the third coordinate of the point should be f, which is the case.

As the third coordinate is always known (equal to f), it is possible to directly determine the coordinates 2D on the plan itself. We have the passage of homogeneous coordinates then 3D to homogeneous coordinates 2D. If one then takes M' coordinates on the plan (sx', sy', S) image of M of coordinates (X, Y, Z, 1) the relation binding the two points will be written in the form:
\ left \begin{matrix} sx' \ \ sy' \ \ S \ \ \end{matrix} \ right]

\ left \begin{matrix} F & 0 & 0 & 0 \ \ 0 & F & 0 & 0 \ \ 0 & 0 & 1 & 0 \ \ \end{matrix} \ right] \ left \begin{matrix} X \ \ Y \ \ Z \ \ 1 \ \ \end{matrix} \ right] What is equivalent to the system \ begin {boxes} sx' = fX \ \ sy' = fY \ \ S = Z \ \ \ end {boxes} maybe, after standardization: \ begin {boxes} x' = fX/Z \ \ y' = fY/Z \ \ S = Z \ \ \ end {boxes}
We find the same values then as previously (x' = X' and y' = Y'). We thus have a formulation which directly gives the coordinates of the point projected on the level considered.

Orthographical projection

In this case, the points are projected according to a direction determined on a level located at a distance f of the origin according to the direction \ vec {K} . Orthographical projection is sometimes interpreted as being a perspective projection into which the point of prospect is rejected ad infinitum. The matrix of associated transformation is then the following one:
\ left \begin{matrix} 1 & 0 & 0 & 0 \ \ 0 & 1 & 0 & 0 \ \ 0 & 0 & 0 & F \ \ 0 & 0 & 0 & 1 \end{matrix} \ right]

Application to the isometric change of reference mark

The homogeneous coordinates take all their interest in this precise case. Indeed, this notation makes it possible to represent the changes of reference mark. If the new reference mark is relocated compared to the old one of a vector t_ {3 \ times1} = (t_x: t_y: t_z) and sees its orientation in same time changed, rotation being described by the matrix R_ {3 \ times3} , then the coordinates of the noted point M (sX', sY', sZ', S) in the new reference mark will be dependant on the coordinates (X, Y, Z, 1) expressed in the old reference mark by the relation:

\ left \begin{matrix} sX' \ \ sY' \ \ sZ' \ \ S \end{matrix} \ right]

\ left \begin{matrix} & & & \ \ & R_ {3 \ times3} & & t_ {3 \ times1} \ \ & & & \ \ 0 & 0 & 0 & 1 \end{matrix} \ right] \ left \begin{matrix} X \ \ Y \ \ Z \ \ 1 \end{matrix} \ right]
The reverse transformation will be given as follows, where R_ {3 \ times3} ^T represents the matrix transposed of R_ {3 \ times3} :

\ left \begin{matrix} sX \ \ sY \ \ sZ \ \ S \end{matrix} \ right]

\ left \begin{matrix} & & & \ \ & R_ {3 \ times3} ^T & & - R_ {3 \ times3} ^Tt_ {3 \ times1} \ \ & & & \ \ 0 & 0 & 0 & 1 \end{matrix} \ right] \ left \begin{matrix} X' \ \ Y' \ \ Z' \ \ 1 \end{matrix} \ right]

Random links:Pottery in wads | Jean-Paul Delevoye | Nina Romashkova | Route main road 538a | Cezary Berezowski | El_Pont_de_Suert