Deborah R. Fowler
Turtle Note
Posted on Sept 2 2018A better hat is show along with the original problem with lead to a really nice website on transformation matrices called academo.org
https://academo.org/demos/rotation-about-point/
First, let's set up the problem and then we will see how rotation
about a point comes into play.
Suppose we take the square function and generalize it to rectangles:
We could make a hat by calling this function twice:
Now what if we wanted to tilt the hat? The problem show below is because our point needs to be rotated.
If we rotate the point using the formulas. Be sure to import
math
Now we have a hat that is tilted. This is a good example of having some knowledge of mathematics.
We could also have draw the hat in a more brute force way. Since
it is one continuous object, we do not head to worry about the
orientation of the turtle.
Better to allow parameter controls
However, what if we wanted a colored band on our hat? We are back to the rotating a point. Perhaps not the most efficient, but an interesting example. Go ahead and create your own hat function.