[MWForum]Calling mathcats: geometry help please

Wendy Petti mwforum@lists.mathcats.com
Thu, 12 Aug 2004 09:01:56 -0400


Well, I feel very silly now that I developed my graphical solution not
having noticed Daniel's great mathematical solution; I had only seen the
second of his two replies somehow until I did a more careful search of my
inbox after reading this morning's follow-up message.  Now we can use
Daniel's mathematical code to check the reliability of my method.

I also didn't mean to drive you nuts for half an hour, Jeff; right after I
sent my attachment I realized I should have mentioned the use of a
programmed color, but I didn't know if it warranted another message to
mention this.  I think it's very interesting that Pro and EX implement
TOWARDS differently, and yes, by all means, please send your Pro utility
feature to the list so we can all benefit from it!

I would also like to note two things about my use of the programmed color:

1) I had set the line thickness to 3.  But in thinking about it after I sent
the attachment, I realized that the output to the "intersection textbox
would only be accurate if we keep the pensize set to 1.  This correction
should be made in the code.  Sorry!

2) Please note that the second turtle traverses the red line with its pen up
and then backs up the length of the line segment with its pen down.  The pen
must be up in order to interact with the programmed color.  But I wanted to
draw the line and that is why I preserved the distance travelled with the
TRAVEL variable and had the turtle back up over the same path.

I once accomplished something similar - in an erosion simulation where the
path of the water erosion would curve to the right or left of
randomly-stamped obstacles - by having the color-detecting turtle advance
one pixel with its pen up, check what color was underneath it, and if it did
not detect the color of an obstacle then it would back up that same pixel
and move forward again one step with its pen down, then repeat the process;
if it did detect the color of an obstacle then it would back up one pixel,
randomly choose to turn right or left 90 degrees, move forward one pixel
again and search for color, attempt to turn back in its original direction
again, and gradually inch its way around the obstacle in this fashion,
drawing an erosion trail one pixel at a time as it explored.

In the line intersection project, the second turtle could similarly advance
one pixel at a time with pen up to detect color and then back up one pixel
and retrace its step while drawing.  But that method seemed inefficient for
this purpose.

One more thing:  in my startup procedure, I should have placed CG after
EVERYONE [HOME] or else asked t2 to put its pen up because otherwise t2
makes a mark as it returns home.  (Actuallly, since the turtles are hidden
it is not necessary for them to return home anyhow.)

Wendy