Introduction to the Geometry Package
This worksheet demonstrates some aspects of the geometry package.
Warning: This worksheet is computationally intensive. You may want to close any other memory-intensive applications before working through this worksheet.
restart
withgeometry:
Envelope of Circles Method
The following sections show how to use the geometry package to construct some curves based on the method called an envelope of circles. (Reference: Geometry And The Liberal Arts by Dan Pedoe)
Constructing a Cardioid
Define the base circle.
circlec0,point⁡o,0,0,1:
Generate a random point A0 on the circle, which is the cusp of the cardioid.
randpointA0,c0:
Generate 50 circles that envelop the constructed cardioid.
i≔1:n≔50: while i ≤ n do randpointA∥i, c0; if evalfHorizontalCoordA0 − HorizontalCoordA∥i ≠ 0 then circlec∥i, A0, A∥i; i ≔ i+1; end if; end do:
Graph the cardioid curve.
draw⁡seq⁡c‖i,i=0..n,printtext=false,scaling=constrained,axes=none,title=Cardioid
Constructing a Limacon de monsieur Pascal
Two Limacon examples are provided in this section.
Limacon with an inner loop
Pick a point outside the circle.
pointA0,2,0:
Generate 50 circles that envelop the constructed limacon.
i≔1:n≔50:
while i ≤ n do randpointA∥i, c0; if evalfHorizontalCoordA0−HorizontalCoordA∥i ≠ 0 then circlec∥i, A0, A∥i; i ≔ i+1; end if;end do:
Graph this curve.
draw⁡seq⁡c‖i,i=0..n,printtext=false,scaling=constrained,axes=none,title=Limacon de monsieur Pascal
Limacon without an Inner Loop
circlec0,point⁡o,0,0,2:
Pick a point inside the circle c0.
pointA0,1,0:
The limacon without an inner loop looks like the following:
draw⁡seq⁡c‖i,i=0..n,printtext=false,scaling=constrained,axes=none,title=Limacon without an inner loop
Constructing a Nephroid
Pick a diameter of c0.
linel,point⁡M,0,−2,point⁡N,0,2:
Generates 60 points on the circle, and for each point Ai, construct a circle with center Ai that touches the line l.
n≔60:
for i to n do randpointA∥i, c0; circlec∥i, A∥i, distanceA∥i, l;end do:
The Nephroid can be constructed by using the draw function.
draw⁡seq⁡c‖i,i=1..n,printtext=false,scaling=constrained,axes=none,title=Nephroid
Euclidean Geometry Theorems
The following two sections demonstrate how the geometry package illustrates two theorems in Euclidean geometry. (Reference: A Survey of Geometry by Howard Eves)
Feuerbach's Theorem
Theorem: The nine-point circle of a triangle is tangent to the incircle and to each of the excircles of the triangle.
Define triangle ABC.
triangleT,point⁡A,0,0,point⁡B,3,−1,point⁡C,6,2:
Find the incircle inc of ABC.
incircleinc,T,centername=II:
Find the excircles ex1, ex2, and ex3 of ABC.
excircleobj,T,ex1⁡I1,ex2⁡I2,ex3⁡I3:
Find the nine-point circles ec of ABC.
EulerCircleec,T,centername=X:
Check if inc, ex1, ex2, and ex3 are tangent to ec.
AreTangent ec, inc ; AreTangent ec, ex1 ; AreTangent ec, ex2 ; AreTangent ec, ex3 ;
true
Feuerbach's Theorem can now be illustrated.
draw⁡inc⁡color=yellow,ec⁡color=plum,ex1⁡color=green,T⁡color=blue,filled=false,filled=true,scaling=constrained,title=Feuerbach's Theorem
Nine-Point Circle Theorem
Theorem: In triangle A1A2A3, let M1, M2, M3 be the midpoints of the sides A2A3, A3A1, A1A2, let H1, H2, H3 be the feet of the altitudes on these sides, and let N1, N2, N3 be the midpoints of the segments A1H, A2H, A3H, where H is the orthocenter of the triangle. Then, the nine points M1, M2, M3, H1, H2, H3, N1, N2, N3 lie on a circle whose center N is the midpoint of the segment joining the orthocenter H to the circumcenter O1 of the triangle, and whose radius is half the circumradius of the triangle.
Define the triangle A1A2A3.
triangleT,point⁡A2,0,0,point⁡A1,2,4,point⁡A3,7,0:
Find the midpoints of A2A3, A1A3, A1A2.
midpointM1,A2,A3:midpointM2,A3,A1:midpointM3,A1,A2:
Find the orthocenter and circumcenter of A1A2A3.
orthocenterH,T:circumcirclec,T,centername=O1:
Find the altitudes of A1A2A3.
altitudeA1H1,A1,T,H1:altitudeA2H2,A2,T,H2:altitudeA3H3,A3,T,H3:
Define the points N1, N2, N3.
midpointN1,A1,H:midpointN2,A2,H:midpointN3,A3,H:
circlec1,midpoint⁡N,H,O1,radius⁡c2:
Check if M1, M2, M3, H1, H2, H3, N1, N2, N3 are on circle c1.
IsOnCircle⁡M1,c1;IsOnCircle⁡M2,c1;IsOnCircleM3,c1;IsOnCircle⁡H1,c1;IsOnCircle⁡H2,c1;IsOnCircleH3,c1;IsOnCircle⁡N1,c1;IsOnCircle⁡N2,c1;IsOnCircle⁡N3,c1
The Nine-Point Circle Theorem can now be plotted.
draw⁡c1⁡filled=true,color=COLOR⁡RGB,1.0,1.0,0.8,c⁡filled=true,color=green,T⁡style=line,color=blue,N,M1,M2,M3,H1,H2,H3,N1,N2,N3,H,scaling=constrained,style=point,symbol=diamond,axes=none,title=Nine-Point Circle
Transformations
The remaining sections illustrate the use of some transformations supported in the geometry package, such as dilatation, homology, rotation, and translation.
Rotation of a Square
MakeSquares‖1,point⁡A,1,0,point⁡B,2,0,diagonal:
n≔30:
for i to n dorotationt‖i,s1,2⁢i⁢πn,counterclockwise,Aend do:
squaresq,point⁡a,0,−1,point⁡b,2,−1,point⁡c,2,1,point⁡d,0,1:
white≔1,1,1:color1≔100−2.4⁢x⁢white100:
draw⁡seq⁡t‖i⁡color=COLOR⁡RGB,op⁡subs⁡x=i,color1,i=1..30,sq⁡color=black,filled=true,printtext=false,scaling=constrained,axes=none,thickness=3,title=Rotation of a Square
Homology of a Square
pointo,0,0:squaresq1,point⁡a1,−2,−2,point⁡a2,2,−2,point⁡a3,2,2,point⁡a4,−2,2:for i from 2 to 10 dohomology(sq∥i,sq∥i−1,o,π4,counterclockwise,12)end do:squaresq,point⁡aa1,−115,−115,point⁡aa2,115,−115,point⁡aa3,115,115,point⁡aa4,−115,115:
draw⁡seq⁡sq‖i,i=1..10,sq⁡color=COLOR⁡RGB,12,12,12,filled=true,color=white,thickness=1,scaling=constrained,axes=none,printtext=false,title=Homology Transformation of a Square,titlefont=TIMES,ROMAN,16
Translation, Rotation, and Dilatiation of Circles
An example of translation, rotation, and dilatation of circles
angle≔table⁡:
n≔8:
foritondoanglei≔2⁢π⁢inend do:dsegmentdseg,point⁡A,0,0,point⁡B,4,0:pointo,0,0:circlec,o,1:homothetyc1,c,32,point⁡M,−1,0:homothetyc2,c,2,point⁡M,−1,0:homothetyc3,c,52,point⁡M,−1,0:translation⁡t,c,dseg:translation⁡tt,c1,dseg:translation⁡ttt,c2,dseg:translationtttt,c3,dseg:forito8dorotation⁡t‖i,t,anglei,counterclockwise,o;rotation⁡tt‖i,tt,anglei,counterclockwise,o;rotation⁡ttt‖i,ttt,anglei,counterclockwise,o;rotation⁡tttt‖i,tttt,anglei,counterclockwise,oend do:squaresqr,point⁡A,−8,−8,point⁡B,8,−8,point⁡C,8,8,point⁡E,−8,8:
draw⁡seq⁡op⁡t‖i⁡color=Red,tt‖i⁡color=Lime,ttt‖i⁡color=Blue,tttt‖i⁡color=Plum,i=1..n,sqr⁡color=Light Yellow,printtext=false,filled=true,axes=none,title=An example of translation, rotation, dilatation of a circle
References
Eves, Howard. A Survey of Geometry. Allyn and Bacon, 1972.
Pedoe, Daniel. Geometry and the Liberal Arts. St. Martin's Press, 1978.
For more information, see the geometry help page.
Return to Index for Example Worksheets
Download Help Document