|
Computer Graphics |
Fall 2000
|
Computer Graphics
Homework 02
6 hours
Copyright © 2000 David C. Banks
// draw a line from (x0,y0) to (x1,y1)
segment(double x0, double y0, double z0,
double r0, double g0, double b0,
double x1, double y1, double z1,
double r1, double g1, double b1)
Implement it in several ways, as described below.
Parametric. Use the vector equation p(t) = p0 + t*dp.
Explicit (height) function. Use the equations y = y(x), r = r(x), etc.
Implicit function. Use the equations x = x(y), r = r(y), etc.
Integration. Use the vector integration equations p = p + h*dp .
Compute the (dot product of the) angle a between the rays
r1=(p1-q) and
r0=(q-p0) for each point q in the image.
If a is close to
zero (hence the dot product D is nearly 1.0 between the unit-length
vectors in the r0, r1 directions), include
q in the line.
You can do this by making your filter function depend
on (1-D)/2.
On the right is an example that I made.