Computer Graphics
CAP 4730

 

Fall 2000
Tuesday/Thursday 9:30am
103 Love Building
Dr. David C. Banks

 

Computer Graphics
Homework 02
6 hours
 
Copyright © 2000 David C. Banks

  1. 0.25 hours
    Box filter

  2. 0.50 hours
    Tent filter

  3. 0.50 hours
    Explicit curve

  4. 0.50 hours
    Parametric curve

  5. 0.50 hours
    Implicit curve

  6. 3.00 hours
    Add a segment() method to your Image class.
    // 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 .
    The vector dp = p1 - p0 points from p0 to p1, and h is the step size.

    Recursive subdivision. Use the midpoint p = 0.5*(p0 + p1) = p0 + 0.5 dp.

    Angle (optional; 50 points extra credit).
    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.

  7. 0.50 hours
    Use your Image class to create .ppm files that are at least 400x400 pixels. Draw the circle c(s) = (r*cos(s), r*sin(s)) with some line segments that connect a few points along the circle. Use the 2D tent filter to draw the points along each segment. Make the colors of the endpoints vary with angle. If the total weight at a pixel exceeds 1.0 at the end of your drawing, divide its colors by "weight" before you write them out to the ppm file.

    Draw the segments using different ones of your algorithms. Name the images parametric.ppm, explicit.ppm, implicit.ppm, integration.ppm, subdivision.ppm (, angle.ppm).

    Convert the images to gif. Insert into your Web page.
    Link your code, headers, and Makefile from your Web page.
    Create a tar.gz file for the directory for this assignment.

  8. 0.25 hours
    Print two copies of the homework 02 grade sheet.
    Print this page.
    Print your code, headers, and Makefile.
    Print your Web page for this assignment.
    Put them inside your notebook to turn in.

  9. Extra credit (50 points)
    Create an animation of the circles. Put it on your web page.