MATHEMATICS

Kamis, 05 September 2013

Flip Flop

Jennifer Silverman made this cool motions maze the other day. (More here.) We collaborated on it a little bit, after she did all the heavy lifting. I added buttons. (I may have a button problem.) It put me in mind of these motion puzzles I used to make in Geometer's Sketchpad, and I got to thinking how much better I could make them now. So I started, with the main new feature I wanted being the ability to generate new puzzles instead of being one static dynamic puzzle.



The user moves points A and B to try to find the line of reflection between the two flip flops. When you hit the Check button, it shows you the reflection over the line you're trying. 

What follows is my GeoGebra geek out over trying to make it look right. Here's the puzzle if you want to skip that: Flip Flop.

One thing I love about Jennifer's sketches are her excellent images. So I tried to step it up with some nice flip flops from openclipart.org.

It turns out the trickiest part was getting both sandals to always show up. That's why I'm writing this post. (A lot of my individual sketches I post at the tumblr.) The key to being able to do this is that in the graphics window you can put variables in for the window dimensions. Define those from the objects in the sketch, and,  voilĂ , you can see both the sandals. So I defined xmin, xmax, ymin and ymax from the two sandals. E.g.,
xmin=floor(Min[{0, x(F1'), x(F2'), x(F3'), x(F4')}]) - 1
But there's a problem then - the graphics won't be in 1:1 scale, which is always nice, but especially important for motions where the two objects should look congruent!

The Corner[ ] command is my new best friend. Corner[n] for 1, 2, 3 & 4 return the coordinates of those corners. Corner[5] returns a point with (width, height). Corner[image name, number] returns the corners of an image. This was handy for finding the corners of the reflection, F1' etc. in the command above. 
So using Corner[5] I could find out the aspect ratio of the graphics window. It took me a few minutes, but I hit on the idea of making the bottom left corner steady, and then altering the top right corner based on the aspect ratio. I defined r = y(Corner[5])/x(Corner[5]) (so, height:width) and:
  • xm = If[(ymax - ymin) / (xmax - xmin) < r, xmax, xmin + (ymax - ymin) / r]
  • ym = If[(ymax - ymin) / (xmax - xmin) < r, ymin + r (xmax - xmin), ymax]
If the sandals give a screen that's not wide enough, it uses the aspect ratio to find a suitable width. If the sandals give a screen that's not tall enough, it uses the aspect ratio to find a good height. (The If[ ] command works like If[condition, then, else], where the else is optional.

The puzzle, as it turns out, is pretty challenging. Give it a try, and let me know what you think. Or let me know an easier better way to do my GeoGebra graphics hacking.

Here's the teacher page for download or the mobile page.

EDIT: Bonus! Jennifer created an assignment to give it more structure as a lesson. (PDF in dropbox.)

Tidak ada komentar:

Posting Komentar