# Adding a Curve in Image_and_Cursor

This tutorial works with the same folder that you downloaded in the first tutorial. If for some reason you do not have this folder click here to download the folder Image_and_Cursor_All in the form of a zip file (248 KB). Then unzip it (this may happen automatically) and place the folder in a convenient place. Your work in this tutorial must take place within this folder.

Begin by opening a new browser window and in the new browser window open the file curve_template.html. You should see a picture of a water fountain. It may take a few minutes to appear. In the unlikely event that this does not work, open the file curve_template_alt.html.

Notice that there is a red curve superimposed on the picture of the water fountain. There are many situations in which you or a student might want to add such a curve to an image. To see how this is done choose Source from the View menu. Look for the lines below.

The six lines highlighted in red specify the curve to be added.

• Setting the parameter curve_sw to 1 specifies that a curve of the form y(x) with the domain a <= x <= b should be added to the image.

• The parameter curve_n describes the number of points on this curve that will be plotted and connected by lines. The value 100 usually works fine but for some curves more points give a better result and for some curves fewer points will work fine.

• The parameter curve_color specifies the color of the curve. It must by of the form RRRGGGBBB, where each of RRR, GGG, and BBB is a three digit number between 000 and 255. Leading zeros may not be omitted. These three components specify the red, green, and blue components of the color.

• The parameters curve_a and curve_b specify the low end and high end of the domain of the function y(x)

• The parameter curve_y_of_x defines the function y(x). The usual mathematical functions may be used. Multiplication must be represented by an asterisk.

As a quick exercise, change the color of the curve to blue. Note that blue must be specified as "000000255". Try a few other colors.

This applet is much more powerful and flexible than we have seen so far. Subsequent tutorials show how to use some of its additional features and the User's Manual (1.1 MB) describes all of its features.