back procedures for SYMMETRY

The symmetry procedures were developed by

Wendy Petti
Founder of Math Cats
wpetti@mathcats.com

and may be used with this acknowledgement.

Please refer to the three screenshots to see
the buttons and sliders needed for each page of the project.


* * * * * * * * * *

to startup
make "no 1 make "line "?
end

to draw.by.turning
turn.right.and.left
make "line "?
end

to draw.by.headings
headings
make "line "?
end

to draw.by.coordinates
coordinates
make "line "?
end

to start.over
ask [t1 t2 t3 t4] [setc color? setpensize 2] clean
ask [t1 t2 t3 t4] [pu home pd]
make "line "?
everyone [st]
end

* * * * * * * *

These four procedures activate the turtle movements on the "turn.right.and.left" page.

to go
ask [t3 t4] [ht]
if :line = "V [go_V stop]
if :line = "H [go_H stop]
if :line = "VH [go_VH stop]
announce [First click on a line of symmetry at the top of the screen.]
end

to go_V
ask [t1 t2] [setc color?]
t1, rt rt_#
t2, lt rt_#
t1, fd fd_#
t2, fd fd_#
end

to go_H
ask [t1 t2] [setc color?]
t1, rt rt_#
t2, lt rt_#
t1, fd fd_#
t2, fd fd_#
end

to go_VH
ask [t1 t2 t3 t4] [setc color?]
ask [t3 t4] [st]
t1, rt rt_#
t2, lt rt_#
t3, rt rt_#
t4, lt rt_#
ask [t1 t2 t3 t4] [fd fd_#]
end

* * * * * * * *

These four procedures activate the turtle movements on the "headings" page.

to go.
ask [t3 t4] [ht]
if :line = "V [go_V. stop]
if :line = "H [go_H. stop]
if :line = "VH [go_VH. stop]
announce [First click on a line-of-symmetry button at the top of the screen.]
end

to go_V.
ask [t1 t2 t3 t4] [setc color?]
t1, seth seth_#
t2, seth 0 - seth_#
t1, fd fd_#
t2, fd fd_#
end

to go_H.
ask [t1 t2 t3 t4] [setc color?]
t1, seth seth_#
t2, seth 180 - seth_#
t1, fd fd_#
t2, fd fd_#
end

to go_VH.
ask [t1 t2 t3 t4] [setc color?]
ask [t3 t4] [st]
t1, seth seth_#
t2, seth 0 - seth_#
t3, seth 180 - seth_#
t4, seth 180 + seth_#
ask [t1 t2 t3 t4] [fd fd_#]
end

* * * * * * * *

These four procedures activate the turtle movements on the "coordinates" page.

to go..
ask [t3 t4] [ht]
if :line = "V [go_V.. stop]
if :line = "H [go_H.. stop]
if :line = "VH [go_VH.. stop]
announce [First click on a line-of-symmetry button at the top of the screen.]
end

to go_V..
ask [t1 t2 t3 t4] [setc color?]
t1, setpos se setx_# sety_#
t2, setpos se 0 - setx_# sety_#
end

to go_H..
ask [t1 t2 t3 t4] [setc color?]
t1, setpos se setx_# sety_#
t2, setpos se setx_# 0 - sety_#
end

to go_VH..
ask [t1 t2 t3 t4] [setc color?]
ask [t3 t4] [st]
t1, setpos se setx_# sety_#
t2, setpos se 0 - setx_# sety_#
t3, setpos se setx_# 0 - sety_#
t4, setpos se 0 - setx_# 0 - sety_#
end

* * * * * * * *

Each of these three procedures is activated by clicking on one of the green icons in the top left corner of a symmetry page before beginning a drawing. Each procedure draws a pale line(or lines) of symmetry and orients the turtles. (The three green icons are turtles wearing "costumes." Each has an instruction (one of the three procedure names below).

to vertical.line.of.symmetry
make "line "V
ask [t1 t2 t3 t4] [pu home pd]
t1, setpensize 1 setc 3 fd 600
pu home pd
setpensize 2 setc color?
ask [t1 t2] [seth 0 setpensize 2]
end

to horizontal.line.of.symmetry
make "line "H
ask [t1 t2 t3 t4] [pu home pd]
t1, seth 90 setpensize 1 setc 3 fd 8000
pu home pd
setpensize 2 setc color?
t1, seth 0
t2, seth 180
end

to vertical.and.horizontal.lines.of.symmetry
make "line "VH
ask [t1 t2 t3 t4] [pu home pd]
t1, setpensize 1 setc 3 fd 600
pu home pd
seth 90 setpensize 1 setc 3 fd 800
pu home pd setpensize 2 setc color?
ask [t1 t2] [seth 0]
ask [t3 t4] [seth 180 st]
end

back to math cats love MicroWorlds Go to symmetry overview! Go to symmetry! Get the MicroWorlds Web Player
so you can use the project
© copyright 2000 -   Wendy Petti of Math Cats.   All Rights Reserved.