The Geometry Applet
I
began writing this applet in Feb. 1996. This is version 1.3, and I expect there will be later versions with more functionality.
I'm using it to illustate Euclid's Elements. Above you see an illustration from Euclid's Elements Book I Propostion 22.
Another example using this Geometry Applet illustrates the
Euler line of a triangle.
Here's how you can manipulate the figure that appears above.
If you click on a point in the figure, you can usually move it in some way.
The free points, colored red, can be freely dragged about, and as they move, the rest of the diagram (except the other free points)
will adjust appropriately. Sliding points, colored orange, can be dragged
about like the free points, except their motion is limited to either a straight
line or a circle, depending on the point.
If you drag the pivot point, colored r or the space key while the cursor is over the diagram, then
the diagram will be reset to its original configuration. If you type u or return the figure will be lifted off the page into a separate window. Typing d or return while the cursor is over the original window will return the diagram to the page. Note that you can resize the floating window to make the diagram larger.
Parameters:
- background - the background color
- font - the font for displaying letters in the figure
- title - the title of the figure, used for a floating frame
- debug - the debugging switch, by default, off
- buffered - whether the graphics are buffered, by default, no
- pivot - the name of a pivot point, if any
- e[i] - an element. The elements are numbered from 1 on up.
Elements
The format for an element is a little complicated. Here's the specifcation for a typical element:
name=e[1] value="A;point;free;50,50;black;magenta"
Each element has a number, a name, an element class, a construction method, and construction data.
Optionally colors may be specified. The number of this element is 1, which means that it is the first element to be created. Its name is A. Its class is point. Its construction method is free, which means it can be freely dragged about. Its construction data is 50,50, which means that it will be initially places at pixel coordinates (50,50). When it is displayed, its name A will be colored black, but the dot representing the point will be magenta.
Elements come in five different classes: point, line, circle, polygon, and sector. Each of these classes has several construction methods. Most of the construction methods can only use one list of construction data, but some can use alternate lists. These geometric classes and construction methods are described in tables after a short description of colors.
Colors
Each element may have up to four colors: first the color of the name of the element; second the color of the 0-dimensional parts (points) of the element; third the color of the 1-dimensional parts (lines or arcs) of the element; and fourth the color of the 2-dimensional parts (if any).
The background color and the colors of the elements can be declared in a couple of different ways. A single word specifying the color may be given. These possible colors are * black, * blue, * cyan, * darkGray, * gray, * green, * lightGray, * magenta, * orange, * pink, * red, * white, and * yellow. If the word "random" is specified, then a randomly chosen pastel will be used. If an element is specified as "background", then it will be given the background color; if "brighter", then a brighter version of the background; if "darker", then a darker version of the background; and if "none" then it won't appear.
Alternatively, a color can be given as a triple of numbers separated by commas to indicate hue (0 to 360), saturation (0 to 100), and brightness (0 to 100).
Element class point |
Construction method |
Construction data |
Description |
free |
2 integers |
a freely dragable point with initial coordinates |
midpoint |
2 points line |
the midpoint C of a line AB |
intersection |
4 points 2 lines |
the intersection E of two lines AB and CD |
first |
line |
the first end A of the line AB |
last |
line |
the last end B of the line AB |
center |
circle |
the center of a circle |
lineSlider |
2 points, 2 integers line, 2 integers |
a point that slides along a line AB with initial coordinates |
circleSlider |
circle, 2 integers |
a point that slides along a circle with initial coordinates |
circumcenter |
3 points |
the center of a circle ABC passing through 3 points A, B, and C |
vertex |
polygon, integer |
a vertex Ai of a polygon A1A2...An with index i |
foot |
3 points point, line |
the foot D of a perpendicular AD drawn to a line BC |
cutoff |
4 points 2 lines |
the point E on a line AB so that AE = CD |
extend |
4 points 2 lines |
the point E on a line AB so that BE = CD |
parallelogram |
3 points point, line |
the 4th vertex D of a parallelogram ABCD given 3 vertices A, B, and C |
similar |
5 points line, 3 points |
the point F so that triangle ABF is similar to CDE |
perpendicular |
2 points line |
the point C so that AC is equal and perpendicular to AB |
proportion |
8 points 4 lines |
the point I on GH so that AB:CD = EF:GI |
invert |
point, circle |
the image of a point A inverted in a circle |
meanProportional |
6 points 3 lines |
the point G on EF so that AB:CD = CD:EG |
Element class line |
Construction method |
Construction data |
Description |
connect |
2 points |
the line AB connecting two points A and B |
angleBisector |
3 points |
the line AD bisecting angle BAC with D on BC |
angleDivider |
3 points, integer |
the line AD with D on BC so that BAD is the nth part of the angle BAC |
foot |
3 points point, line |
the line AD drawn perpendicular to BC |
chord |
2 points, circle line, circle |
the intersection of a line AB in a circle |
bichord |
2 circles |
the common chord connecting the two intersections of circles |
perpendicular |
2 points line |
the line AC equal and perpendicular to AB |
cutoff |
4 points 2 lines |
the line AE equal to CD along the line AB |
extend |
4 points 2 lines |
the line BE equal to CD so that A, B, and C are collinear with B between A and C |
parallel |
3 points point, line |
the line AD parallel and equal to BC |
similar |
5 points line, 3 points |
the line AF so that triangle ABF is similar to CDE |
proportion |
8 points 4 lines |
the line GI along GH so that AB:CD = EF:GI |
meanProportional |
6 points 3 lines |
the line EG along EF so that AB:CD = CD:EG |
Element class circle |
Construction method |
Construction data |
Description |
radius |
2 points line |
the circle with center A and radius AB |
3 points point, line |
the circle with center A and radius BC |
circumcircle |
3 points |
the circle passing through 3 points A, B, and C |
invert |
2 circles |
the image of the first circle inverted in the second |
Element class polygon |
Construction method |
Construction data |
Description |
square |
2 points line |
the square ABCD on a side AB |
triangle |
3 points |
the triangle ABC given 3 vertices A, B, and C |
quadrilateral |
4 points |
the quadrilateral ABCD given 4 vertices A, B, C, and D |
pentagon |
5 points |
the pentagon given 5 vertices |
hexagon |
6 points |
the hexagon given 6 vertices |
equilateralTriangle |
2 points line |
the equilateral triangle ABC on a side AB |
parallelogram |
point, line 3 points |
the parallelogram ABCD given A, B, and C |
regularPolygon |
2 points, integer line, integer |
the regular polygon on a side AB given the number of vertices n |
starPolygon |
2 points, 2integers line, 2 integers |
the star polygon on a side AB given the number of vertices n and the density d |
similar |
5 points line, 3 points |
the triangle ABF similar to CDE |
application |
polygon, 3 points |
given points B, C, and D, the parallelogram equal to the given polygon with one side BC and one angle BCD |
Element class sector |
Construction method |
Construction data |
Description |
sector |
3 points |
the sector of a circle given the center and two points on the circumference |
arc |
3 points |
the sector of a circle whose arc passes through three points |
Source files
The Geometry Applet uses a
Slate Canvas put all the Elements on.
The slate can be lifted off into a separate window, and that uses
ClientFrame, a subclass of Frame.
An Element is a generic thing which is subclassed
in five different ways to give actual elements that can be displayed.
These five classes are further subclassed, too
- PointElement with subclasses
CircleSlider,
FreePoint,
Intersection,
LineSlider,
Midpoint, and
InvertPoint.
- LineElement with subclasses
AngleDivider,
Bichord,
Chord,
Foot,
Layoff,
Perpendicular,
Proportion, and
MeanProportion.
- CircleElement with subclasses
Circumcircle and
InvertCircle.
- PolygonElement with subclasses
Application,
RegularPolygon, and
Similar.
- SectorElement with subclass
Arc.
David E. Joyce
Department of Mathematics and Computer Science
Clark University
Worcester, MA 01610
Email: djoyce@clarku.edu
My nonJava Homepage
and my
Java homepage