[MWForum]Three dimensional prism

Ralph Wege mwforum@lists.mathcats.com
Sun, 05 Jan 2003 23:10:41 -0800


I am using this project in my middle school enrichment class.
This is a set of procedures that gives a three dimensional wire frame
view of a prism. The :n is the number of sides of the prism; :s is the
length of each side and :i is the height of the prism. This is
interesting for students since this object can be rotated depending on
the heading of the turtle at the beginning of the prism procedure. The
main program is the prism procedure. Can anyone color in the sides?

to prism :n :s :i
make "k 0
poly :n :s
mv :i
poly :n :s
mv1 :i
conn :n :s
end

to poly :n :s
repeat :n [fd :s rt 360 / :n]
end

to mv :i
lt 30
fd :i
rt 30
end

to mv1 :i
lt 30
bk :i
rt 30
end

to conn :n :s
repeat :n [fd :s lt :k conn1 :s rt :k rt 360 / :n  make "k :k + 360 / :n

]
end

to conn1 :i
lt 30 fd :i
bk :i
rt 30
end

Thank you for all the help in this forum.

Ralph Wege