Computer Graphics I

Assignment 9

Group III (Yavor Kaloyanov)

Jan Hendrik Dithmar

2031259

Pascal Gwosdek

2505221

Assignment 9  Dithmar (2031259), Gwosdek (2505221)

9.1 Homogenous Coordinates

a. Let m̃ = (x, y, z, w) be an homogenous point. Then this point represents the point m = (\frac{x}{w}, \frac{y}{w}, \frac{z}{w}) in euclidean coordinates, except for w = 0 (these points are located at infinity). Now we multiply our point m̃ with an arbitrary α ≠ 0:

m̃′ = αm̃ = α · (x, y, z, w)
= (αx, αy, αz, αw)

To get the euclidean point, that is represented by this homogenous point m̃′ we divide the first three components again by the forth:

m′ = (\frac{αx}{αw}, \frac{αy}{αw}, \frac{αz}{αw}) = (\frac{x}{w}, \frac{y}{w}, \frac{z}{w}) = m

□

b. Figure:

0 p_{0}  p_{1} p_{2} m_{1} m_{3}  m_{2} m

To get the center m = (m_{x}, m_{y}, m_{z}) between three points p_{0} = (a_{0}, b_{0}, c_{0}), p_{1} = (a_{1}, b_{1}, c_{1}) and p_{2} = (a_{2}, b_{2}, c_{2}) in euclidean coordinates we make the following computations:

m_{1} = \frac{p_{0} + p_{1}}{2}

By the properties of the barycenter in a triangle we get:

m = m_{1} + \frac{1}{3} · (p_{2} − m_{1})

= \frac{p_{0} + p_{1}}{2} + \frac{2p_{2} − p_{0} − p_{1}}{3 · 2}

= \frac{3p_{0} + 3p_{1} + 2p_{2} − p_{0} − p_{1}}{6}

= \frac{2p_{0} + 2p_{1} + 2p_{2}}{6}

= \frac{p_{0} + p_{1} + p_{2}}{3}

Now we’ll make the component wise addition of the three points in homogenous coordinates:

m̃ = ( \begin{matrix}a_{0} \\ b_{0} \\ c_{0} \\ 1 \end{matrix} ) + ( \begin{matrix}a_{1} \\ b_{1} \\ c_{1} \\ 1 \end{matrix} ) + ( \begin{matrix}a_{2} \\ b_{2} \\ c_{2} \\ 1 \end{matrix} ) = ( \begin{matrix}a_{0} + a_{1} + a_{2} \\ b_{0} + b_{1} + b_{2} \\ c_{0} + c_{1} + c_{2} \\ 3 \end{matrix} )

In euclidean coordinates m̃ is:

\frac{1}{3} · ( \begin{matrix}a_{0} + a_{1} + a_{2} \\ b_{0} + b_{1} + b_{2} \\ c_{0} + c_{1} + c_{2} \end{matrix} ) = \frac{p_{0} + p_{1} + p_{2}}{3} = m

□

c. Define the addition ⊕ between two homogenous points ã, b̃ as follows:

ã ⊕ b̃ = ( \begin{matrix}a_{x}b_{w} + b_{x}a_{w} \\ a_{y}b_{w} + b_{y}a_{w} \\ a_{z}b_{w} + b_{z}a_{w} \\ b_{w}a_{w} \end{matrix} )

The corresponding euclidean point for ã ⊕ b̃ is then

\frac{1}{b_{w}a_{w}} · ( \begin{matrix}a_{x}b_{w} + b_{x}a_{w} \\ a_{y}b_{w} + b_{y}a_{w} \\ a_{z}b_{w} + b_{z}a_{w} \end{matrix} )

The corresponding euclidean point to ã is a = (\frac{a_{x}}{a_{w}} , \frac{a_{y}}{a_{w}} , \frac{a_{z}}{a_{w}} )^{T} (with

a_{w} ≠ 0). For b̃ we obtain b analogously. Then we get for the standard addition:

a + b = ( \begin{matrix}\frac{a_{x}}{a_{w}} + \frac{b_{x}}{b_{w}} \\ \frac{a_{y}}{a_{w}} + \frac{b_{y}}{b_{w}} \\ \frac{a_{z}}{a_{w}} + \frac{b_{z}}{b_{w}} \end{matrix} ) = ( \frac{a_{x}b_{w} + b_{x}a_{w}}{a_{w}b_{w}} ; \frac{a_{y}b_{w} + b_{y}a_{w}}{a_{w}b_{w}} ; \frac{a_{z}b_{w} + b_{z}a_{w}}{a_{w}b_{w}} )

Now it is obvious that (ã ⊕ b̃) is the corresponding homogenous point to the euclidean one (a + b).

9.4 Homogenous Lines in 2D*

Claim:

( \begin{matrix}p_{x} \\ p_{y} \\ p_{w} \end{matrix} ) × ( \begin{matrix}q_{x} \\ q_{y} \\ q_{w} \end{matrix} ) = ( \begin{matrix}a \\ b \\ c \end{matrix} )

where ax + by + c = 0 is the line through p and q. Proof:

a = p_{y}q_{w} − p_{w}q_{y}
b = p_{w}q_{x} − p_{x}q_{w}
c = p_{x}q_{y} − p_{y}q_{x}

Test if p is on the line:

(p_{y}q_{w} − p_{w}q_{y})\frac{p_{x}}{p_{w}} + (p_{w}q_{x} − p_{x}q_{w})\frac{p_{y}}{p_{w}} + (p_{x}q_{y} − p_{y}q_{x})

= \frac{p_{x}p_{y}q_{w}}{p_{w}} − p_{x}q_{y} + p_{y}q_{x} − \frac{p_{x}p_{y}q_{w}}{p_{w}} + p_{x}q_{y} − p_{y}q_{x}
= 0

Test if q is on the line:

(p_{y}q_{w} − p_{w}q_{y})\frac{q_{x}}{q_{w}} + (p_{w}q_{x} − p_{x}q_{w})\frac{q_{y}}{q_{w}} + (p_{x}q_{y} − p_{y}q_{x})

= p_{y}p_{x} − \frac{p_{w}q_{y}q_{x}}{q_{w}} + \frac{p_{w}q_{x}q_{y}}{q_{w}} − p_{x}q_{y} + p_{x}q_{y} − p_{y}q_{x}
= 0
□