The Geometry Applet

version 1.3.1

java applet or image

*** If you can read this, you're only seeing an image, not the real java 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:

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.

Specific colors may be given by their red, green, and blue components as six hex digits in an rrggbb format.

Alternatively, a color can be given as a triple of decimal 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 x, y a freely dragable point with initial coordinates (x,y)
midpoint 2 points A, B the midpoint C of a line AB
line AB
intersection 4 points A, B, C, D the intersection E of two lines AB and CD
2 lines AB, CD
first line AB the first end A of the line AB
last line AB the last end B of the line AB
center circle the center of a circle
lineSlider 2 points A, B, 2 integers x, y a point that slides along a line AB with initial coordinates (x,y)
line AB, 2 integers x, y
circleSlider circle, 2 integers a point that slides along a circle with given initial coordinates
circumcenter 3 points A, B, C the center of a circle ABC passing through 3 points A, B, and C
vertex polygon A, integer i a vertex Ai of a polygon A1A2...An with index i
foot 3 points A, B, C the foot D of a perpendicular AD drawn to a line BC

point A, line AB
cutoff 4 points A, B, C, D the point E on a line AB so that AE = CD
2 lines AB, CD
extend 4 points A, B, C, D the point E on a line AB so that BE = CD
2 lines AB, CD
parallelogram 3 points A, B, C the 4th vertex D of a parallelogram ABCD given 3 vertices A, B, and C
point A, line BC
similar 5 points A, B, C, D, E the point F so that triangle ABF is similar to CDE
line AB, 3 points C, D, E
perpendicular 2 points A, B the point C so that AC is equal and perpendicular to AB
line AB
proportion 8 points A, B, C, D, E, F, G, H the point I on GH so that AB:CD = EF:GI
4 lines AB, CD, EF, GH
invert point A, circle the image of a point A inverted in a circle
meanProportional 6 points A, B, C, D, E, F the point G on EF so that AB:CD = CD:EG
3 lines AB, CD, EF

Element class line
Construction method Construction data Description
connect 2 points A, B the line AB connecting two points A and B
angleBisector 3 points A, B, C the line AD bisecting angle BAC with D on BC
angleDivider 3 points A, B, C, integer n the line AD with D on BC so that BAD is the nth part of the angle BAC
foot 3 points A, B, C the line AD drawn perpendicular to BC

point A, line AB
chord 2 points A, B, circle the intersection of a line AB in a circle
line AB, circle
bichord 2 circles the common chord connecting the two intersections of circles
perpendicular 2 points A, B the line AC equal and perpendicular to AB
line AB
cutoff 4 points A, B, C, D the line AE equal to CD along the line AB
2 lines AB, CD
extend 4 points A, B, C, D the line BE equal to CD so that A, B, and C are collinear with B between A and C
2 lines AB, CD
parallelogram 3 points A, B, C the line AD parallel and equal to BC
point A, line BC
similar 5 points A, B, C, D, E the line AF so that triangle ABF is similar to CDE
line AB, 3 points C, D, E
proportion 8 points A, B, C, D, E, F, G, H the line GI along GH so that AB:CD = EF:GI
4 lines AB, CD, EF, GH
meanProportional 6 points A, B, C, D, E, F the line EG along EF so that AB:CD = CD:EG
3 lines AB, CD, EF

Element class circle
Construction method Construction data Description
radius 2 points A, B the circle with center A and radius AB
line AB
3 points A, B, C the circle with center A and radius BC
point A, line BC
circumcircle 3 points A, B, C 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 A, B
line
the square ABCD on a side AB
triangle 3 points A, B, C the triangle ABC given 3 vertices A, B, and C
quadrilateral 4 points A, B, C, D the quadrilateral ABCD given 4 vertices A, B, C, and D
pentagon 5 points A, B, C, D, E the pentagon given 5 vertices
hexagon 6 points A, B, C, D, E, F the hexagon given 6 vertices
equilateralTriangle 2 points A, B the equilateral triangle ABC on a side AB
line AB
parallelogram 3 points A, B, C the parallelogram ABCD given A, B, and C
point A, line BC
regularPolygon 2 points A, B, integer n the regular polygon on a side AB given the number of vertices n
line AB, integer n
starPolygon 2 points A, B, 2 integers n, d the star polygon on a side AB given the number of vertices n and the density d
line AB, 2 integers n, d
similar 5 points A, B, C, D, E the triangle ABF similar to CDE
line AB, 3 points C, D, E
application polygon A, 3 points B, C, D the parallelogram equal to the given polygon A with one side BC and one angle BCD

Element class sector
Construction method Construction data Description
sector 3 points A, B, C the sector of a circle given the center A and two points B and C on the circumference
arc 3 points A, B, C the sector of a circle whose arc passes through the three points A, B and C

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 The source files for version 1.3.1, the associated class files, and a couple of html files have been tar'd and gzip'd into the file http://aleph0.clarku.edu/~djoyce/java/Geometry/Geometry1.3.tar.gz of 56k. To convert it back to a folder of files, first issue the command
gzip -d Geometry1.3.tar.gz
, then the command
tar -xvf Geometry1.3.tar
.

Habanero version

Laurent Feuillet at the NCSA Habanero Project has converted this Geometry applet into the Geometry Tool, a stand-alone collaborative application.


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