This is probably a stupid little post.
The other day I was making some math games, and I needed a rectangular array for a board. As one often does. So I made a quick GeoGebra sketch. And rather than make it so it only made one board, I made sliders so that it could make any rectangular board. Of course sometimes you'd have to zoom out to see the whole thing. A little clunky.
Then Tim Cieplowski (the BGU prof with the beautiful GeoGebra stuff) tweets:
Which makes me feel like I should do a proper job.
One of the things I love about GeoGebra is that you can make the window dynamic, so that it automatically fits what you want to show.
The problem with doing the array is that fitting it to the window will make it non-square and change the game board. So here's my workaround.
The array is just a ratio to compare a window of array plus a border of .5 to the actual graphics window. Corner[1] is the lower left corner around counter-clockwise to the upper left Corner[4]; those are helpful for making things that go right to the edge. Corner[5] gives the (width, height) in pixels of the graphics window. (You can even ask for Corner[2,5] if you have the second graphics window.) So these definitions make the window fit the height if that is taller than the width is wide, relative to the window.
Bonus: this is the closest I have come to doing the Border problem in real life. (Which is so well known that it comes up ahead of immigration stories, even.)
Here's the sketch on GeoGebraTube.
Can you think of a quicker or more elegant way to do this?
Thursday, November 13, 2014
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment