## Description

For this assignment, your TA will supply a C program to help generate image files that you

will display. For each case you only need to change the indicated two assignment statements

for the image coordinates xprime and yprime. You will also need to add declarations for any

other variables that you may need, for example, to define constants. The supplied function

plot logical point maps the (x

′

, y′

) image plane over the range −4 ≤ x

′ ≤ 4 and −4 ≤ y

′ ≤ 4 to

image pixel coordinates.

Consider the imaging system of Figure 2-1 in the Horn textbook (page 20) having a pinhole

at the origin with the z-axis horizontal (positive z to the left), the y-axis vertical (positive y up)

and the x-axis forward (positive x out). The image plane is located at z = f

′

(f

′ > 0). All

events in 3-D are assumed to take place in the space z < 0. The coordinates (x

′

, y′

) define points

in the image plane and the coordinates (x, y, z) define points in the world. Curves in space can

be defined parametrically using the parameter t.

1. For a line in 3-D the parametric equations are:

x = x0 + ta

y = y0 + tb

z = z0 + tc

for constants x0, y0, z0, a, b, and c. As t takes on values in the range (−∞, ∞) we get a line.

a) Write expressions for the image coordinates x

′ and y

′

in terms of these constants and f

′ and t

for both the perspective and orthographic projection of the line.

b) Is the perspective projection of the line also a line in the image? Explain.

c) Is the orthographic projection of the line also a line in the image? Explain.

d) Using the constant settings:

x0 = .5

y0 = −1

z0 = 0

a = 0

b = 1

c = −1

f

′ = 1

use a C program to generate images of both the perspective and orthographic projections of the

line. Since ±∞ is difficult to represent in the computer we can use values of t for a smaller

range like between 0.01 and 10000. The sample C program will only display regions in the range

−4 ≤ x

′ ≤ 4, −4 ≤ y

′ ≤ 4 so you may want to further limit the range of t so that the values of

x

′ and y

′ will fall within this range.

e) What happens in the perspective projection case as t goes to ∞? Is this consistent with the

image that your program generates?

2. For two parallel lines in a plane that is parallel to the image plane the value for z is a

constant z0. The parametric equations for these lines are

x = x1 + ta

xˆ = x2 + ta

y = y1 + tb

yˆ = y2 + tb

z = z0

zˆ = z0

where Line 1 is defined by (x, y, z) and Line 2 is defined by (ˆx, y, ˆ zˆ) and t is in the range (−∞, ∞).

a) Write expressions for the image coordinates x

′

and y

′

in terms of the constants above and f

′

and t for both the perspective and orthographic projection of the lines.

b) Using the following constant settings:

x1 = 0.5

x2 = −0.5

y1 = −1

y2 = −1

z0 = −1, −2, −3

a = 1

b = 1

f

′ = 1

use a C program to generate images of both the perspective and orthographic projections of the

lines by letting t range from 0.01 to 10000.

c) Will the projections of the lines in the image be parallel for i) perspective projection and ii)

orthographic projection? Explain.

d) Is your answer for part c) consistent with the images that your program generates?

e) Is orthographic projection a good approximation to perspective projection for the geometry

for this problem? Explain.

f) What occurs if z0 = |f

′

|?

3. Consider two parallel lines that lie in a plane that is not parallel to the image plane. Assume

that these lines are defined by

x = x1

xˆ = x2

y = y0 + tb

yˆ = y0 + tb

z = z0 + tc

zˆ = z0 + tc

a) Write expressions for the image coordinates x

′ and y

′

in terms of the constants above and f

′

and t for both the perspective and orthographic projection of the lines.

b) Using the following constant settings,

x1 = −1

x2 = 1

y0 = −1

z0 = 0

b = 0, 1, −1

c = 1, −1

f

′ = 1

use a C program to generate images of both the perspective and orthographic projections of the

lines by letting t range from 0.01 to 10000.

c) Will the projections of the lines be parallel for i) perspective projection and 2) orthographic

projection? Explain.

d) Is your answer for part c) consistent with the images that your program generates?

e) Is orthographic projection a good approximation to perspective projection for the geometry

for this problem? Explain.

f) What happens in the perspective projection as t goes to ∞? Is this consistent with the images

that your program generates for this case?

What to turn in: Submit the displayable images that you generate and your code. You are

also required to demonstrate your code to your TA during lab.