Chickscope Math:
Code for the Drawing an Oval
Applets
You can browse the Java source code of the
oval-drawing applets, but please respect the
copyright of the author, Stuart Levy
(slevy@ncsa.uiuc.edu),
NCSA, University of Illinois, Urbana-Champaign,
October 1997.
Or, pick up the source and class files in
oval.tar.gz.
By default the applet offers three menu
choices, but these can be extended or replaced by
applet parameters. They include settings
parameters, which are strings of the form:
var=value var=value ...
separated by blanks, but with no blanks around the
= signs.
Variables you can set are:
- e=number
- Set eccentricity; number should be
between 0 and 1.
- p=number
- Set parameter p, the distance
weighting for Descartes ovals,
or distance product for Cassini ovals.
Reasonable values are from .25 to 2.5.
- curve=on or curve=off
- Display the curve (as a fine gray line) or don't.
- slider=on or slider=off
- Display the slider for adjusting p.
- cassini=on or cassini=off
- Display Cassini (constant-product) ovals if
on, Cartesian (constant-sum) ovals (ellipses
if p=1) if off.
It's not necessary to set all variables in a
settings string; variables not mentioned for a
menu item will be unchanged when it's
selected.
Click with the right mouse button on the
drawing area to display the current settings in
the Java console, suitable for pasting into
appropriate applet parameter strings.
The available applet parameters are:
<PARAM NAME="settings" VALUE="initial settings string">
<PARAM NAME="menu1" VALUE="label for first menu item">
<PARAM NAME="settings1" VALUE="settings to apply when this item selected">
<PARAM NAME="menu2" VALUE="label for second menu item">
<PARAM NAME="settings2" VALUE="settings to apply when selected">
and so on, for as many menui and
settingsi as desired.
By default, the standard
"Ellipse"/"Cartesian"/"Cassini" menu items appear
after any items specified by applet parameters.
To provide a menu containing only the specified
entries, provide "clearmenu" as a parameter (value
doesn't matter):
<PARAM NAME="clearmenu" VALUE="">
As an example, you could re-create the default
behavior with the following parameters:
<APPLET CODEBASE="whatever" CODE="Curve.class">
<PARAM NAME="clearmenu" VALUE="">
<PARAM NAME="settings" VALUE="p=1 e=.5 slider=off curve=on cassini=off">
<PARAM NAME="menu1" VALUE="Ellipse">
<PARAM NAME="settings1" VALUE="p=1 slider=off cassini=off">
<PARAM NAME="menu2" VALUE="Cartesian Oval">
<PARAM NAME="settings2" VALUE="slider=on cassini=off">
<PARAM NAME="menu3" VALUE="Cassini Oval">
<PARAM NAME="settings3" VALUE="slider=on cassini=on">
message to display for non-Java browsers here...
</APPLET>