Bar Plot
Exercise


Description


VRML Concepts

Files

Tasks


  1. Make a copy of the "barplot.c" program:

    The bar plot program generates bars that are all white. Your task is to modify the barplot1.c program to add color to each bar. Make the color of each bar a function of the bar's height.

    Recompile and run the new barplot1 program, and view the resulting VRML scene (call it "barplot1.wrl").

    SOLUTION: barplot1.c, barplot1.wrl


  2. Make a copy of the "barplot1.c" program:

    The bars on a bar plot give a quick over-all impression of the changing values of a function, like a sine wave. Numeric labels on bars are often used to show the actual value for each bar. Your task is to modify the barplot2.c program to add a numeric text label for each bar. Put the label above the bars that go up from the horizontal zero-line, and put the labels below the bars that go down.

    SOLUTION: barplot2.c, barplot2.wrl


  3. Extra credit: Make a copy of the "barplot2.c" program:

    When you spin the bar plot around, the flat text labels disappear when viewed edge-on. Your task is to make the text labels always face the viewer.

    SOLUTION: barplot3.c, barplot3.wrl