|
To construct a regular pentagon, you build a special intermediate smaller circle.
The script demonstrates in particular the features below. To get information on a particular term, select it (in Smile) then press ⌘⇧F.
-
how to use the positional parameters to draw the names in the right place: [rt], [t]
-
how to have a point's name print on a line: markpoint,
-
how to draw a thinner line: SetPenWidth(0.5),
- DrawPolygon automatically draws the points' names if it is given a list of named points.
|
Import script
BeginFigure(0)
SetTextFont("Monaco")
SetTextSize(10)
SetUserTransformation({150, 0, 0, 150, 200, 200})
SetArrowSize({3, 8, 4})
CirclePath({0, 0}, 1)
DrawVector({-1.2, 0}, {1.2, 0})
DrawVector({0, -1.2}, {0, 1.2})
DrawPath(2)
set r to (sqrt 5) / 4
CirclePath({-0.25, 0}, r)
set x1 to -0.25 + r
MoveTo({x1, -1.2})
LineTo({x1, 1.2})
set y1 to sqrt (1 - x1 * x1)
set l to {{1, 0}, {x1, y1}}
set x2 to -0.25 - r
MoveTo({x2, -1.2})
LineTo({x2, 1.2})
SetPenWidth(0.5)
DrawPath(2)
markpoint {point:{-0.25, 0}, name:"-1/4", hint:"t"} on {{-1, 0}, {1, 0}} magnitude 3
DrawPath(2)
SetPenWidth(1)
set y2 to sqrt (1 - x2 * x2)
set l to l & {{x2, y2}, {x2, -y2}, {x1, -y1}}
set ll to {{point:item 1 of l, name:"A_1", hint:"rb"}}
repeat with i from 2 to 5
set ll to ll & {{point:item i of l, name:"A_" & i}}
end repeat
SetTextOffset(3, 4)
SetCenter({-0.25, 0})
SetPenColor({1, 0, 0})
DrawPolygon(ll)
DrawPath(2)
TextMoveTo({1, 0})
DrawString("[rt]1")
TextMoveTo({0, 0.5})
DrawString("[rt]1/2")
TextMoveTo({0, 1})
DrawString("[tr]1")
EndFigure()
|