[MWForum]guidelines for posting to MWForum - and text of Jeff's attachment
Wendy Petti
mwforum@lists.mathcats.com
Thu, 2 Jan 2003 10:28:45 -0500
Hi Folks,
Here are guidelines for sharing text and projects on this forum,
followed by the text of Jeff's attachment:
1) Delete any unnecessary text or other materials when you are replying;
keep only what is essential for the readers to understand the context of
your reply.
2) It is best to send messages in text-only format rather than HTML
format. Most mail programs provide an easy means to switch back and
forth. This is not critical, but it does save file space and most
mailing lists prefer it.
3) Please realize that some of the subscribers to this list receive a
daily digest, and the digest version does not display attachments. So
whenever possible, such as when sending procedures, please copy and
paste them into the body of the message itself. I have done this below
with Jeff's latest message.
4) We love to see procedures in context. It is fine to send MW projects
as attachments. When projects are sent to the group, I will then post
them online as well so that digest members can view them. Sometimes it
takes me a day or two to get around to this. The URL for viewing these
attachments is:
http://www.mathcats.com/mwforum/attachments.html
5) The more you share, the more we all learn!!! We would love to hear
from you. And if you don't get an answer to your question, it doesn't
mean we don't care; it probably means that we just don't know. Jeff
asked yesterday for help with his video problem, and this is beyond my
own scope of expertise. But I will tell you that whenever I am stumped,
I call Shawn at LCSI at 1-800-321-LOGO and he is full of helpful
information. If he doesn't have the answer, he will usually research it
and get back to you. Also, sometimes this is the only way that LCSI
becomes aware of glitches. I'm guessing that there is an
incompatibility between Jeff's version of MicroWorlds and his browser,
and perhaps he simply needs to ask LCSI for the latest version, which
they usually supply for free. Otherwise, perhaps they need to put out a
new version to address this glitch.
Below my name you'll find the text of the attachment that Jeff sent to
the list. Thanks for sharing, Jeff, and please send the whole project!
It sounds fascinating.
Wendy Petti
MWForum moderator
* * *
Here is the text of Jeff's attachment:
2 Jan. '03
Hi Daniel-
Well, you asked for it....I'm afraid that a good deal of this code is
specific to my application, and makes little sense outside that context.
Everything concerning "mag & "magnet & "chkpts & the many colors it's
sensitive to, has to do with responding to other figures previously
drawn or generated in my app, and should be excised. References to
REPORT have to do with writing to little textboxes the distances
traversed in feet and inches in the scale of my app - and should also be
excised. Text39 is a user prompt for the correct keys to implement the
different modes and options expressed in GETMODE. The stuff about
REVERSE and DEFLECT has to do with the fact my app needs all the closed
figures in counter-clockwise order, but users often don't cooperate.
CLEANUP, CLEANFIG, TSTANG & TESTANG get rid of redundant and backtracked
points created by users wanting to make doubly sure that point is in
there. Somehow, it all adds up to a fairly bulletproof deal. At the
end, the whole figure is redrawn with DRAWFIG, because the
rubber-banding sometimes leaves little gaps in the image.
The key procedures are ORTHO (which is misnamed) and DOPT (read "do
point"). At the end, I've included the TOWARD I spoke of, and ANG,
which measures the interior angle of two joined segments.
Good Luck!
-JEFF
TO FOG ;basic figure generator
make "fig []
if not :chkpts = [] [make "mag "on tto "mask ht tto "cross]
forever [GETMODE]
tto "cross
ht
make "mode 3
pu
set "text39 "visible? "true
set "yellow "mouseclick [DOPT]
set "black "mouseclick [DOPT]
set "red "mouseclick [DOPT]
set "blue "mouseclick [DOPT]
set "green "mouseclick [DOPT]
make "col color
forever [REPORT]
ORTHO
set "text39 "visible? "false
set "yellow "mouseclick []
set "black "mouseclick []
set "red "mouseclick []
set "blue "mouseclick []
set "green "mouseclick []
cancel [GETMODE]
CLEANUP
TESTANG
if :deflects = -360 [REVERSE]
pu
end
TO REVERSE ;makes clockwise into ccwise
make "tempfig []
RVRS :fig
make "fig :tempfig
end
TO RVRS :pts ;see above
if :pts = [] [stop]
make "tempfig fput first :pts :tempfig
RVRS bf :pts
end
TO CLEANUP ;see above - purges redundancies
make "tempfig []
CLEANFIG bf :fig
make "fig :tempfig
make "fig fput last :fig :fig
end
TO CLEANFIG :pts ;see above
if (count :pts) = 1 [make "tempfig lput first :pts :tempfig stop]
if not member? first :pts bf :pts [make "tempfig lput first :pts
:tempfig]
CLEANFIG bf :pts
end
TO TESTANG ;purges backtracks & tracks rotation
make "tempfig []
make "deflects 0
make "fig lput first bf :fig :fig
TSTANG :fig
make "tempfig fput last :tempfig :tempfig
make "fig :tempfig
end
TO TSTANG :pts ;see above
if (count :pts) = 2 [stop]
ANG (list first :pts first bf :pts first bf bf :pts)
if and not :ang = 0 not :ang = 360 [make "tempfig lput first bf :pts
:tempfig DEFLECT make "deflects :deflects + :dflt]
TSTANG bf :pts
end
TO DEFLECT ;see above
ifelse :ang > 180 [make "dflt (180 - :ang)][make "dflt :ang]
end
TO GETMODE ;called by FOG
let [key readchar]
;;;What is mode 1 for? Right now it is "mag
if :key = "m [mag] ;magnet on/off
if :key = "r [make "mode 3] ;rectangular
if :key = "d [make "mode 2] ;diagonal
if :key = "c [make "mode 4] ;close
if :key = "u [make "mode 5] ;undo
if :key = "e [make "mode 6] ;end
end
;break up ORTHO into different units?
TO ORTHO ;called by FOG
;if :mode = 1 [tto "mask ifelse :mag = "on [st make "mag "off][ht make
"mag "on] tto "cross]
if :mode = 7 [setc 9 setpos mousepos setpos last :fig waituntil [:mode >
1]]
if not :fig = [] [if and (last mousepos) > -235 :mode = 3 [make "x
(first mousepos) - (first last :fig) make "y (last mousepos) - (last
last :fig) ifelse (abs :x) > (abs :y) [pd setc 9 setpos last :fig setc
:col setx first mousepos sety last last :fig][pd setc 9 setpos last :fig
setc :col sety last mousepos setx first last :fig]] if and (last
mousepos) > -235 :mode = 2 [setc 9 setpos last :fig setc :col setpos
mousepos]]
if :mode = 4 [setc 9 setpos last :fig setc :col setpos first :fig make
"fig lput first :fig :fig make "mode 1 waituntil [:mode > 1]]
if :mode = 5 [ifelse (count :fig) > 1 [setc 9 setpos last :fig pd setpos
last bl :fig make "fig bl :fig make "mode 1 waituntil [:mode > 1]][make
"fig [] pu make "mode 3]]
if :mode = 6 [cancel [REPORT] setc 9 setpos mousepos setpos last :fig
setc :col DRAWFIG :fig pu tto "mask st tto "cross stop]
ORTHO
end
TO DOPT ;see above
make "pt mousepos
if and (not :chkpts = []) :mag = "on [make "close 4 CHECK
:chkpts];;;NEED WORK
if :fig = [] [setpos :pt pd make "fig lput :pt :fig stop]
if :mode = 3 [ifelse (abs :x) > (abs :y) [make "fig lput list (first
:pt) (last last :fig) :fig] [make "fig lput list (first last :fig) (last
:pt) :fig]]
if :mode = 2 [make "fig lput :pt :fig]
end
TO CHECK :pts ;see above
if :pts = [] [stop]
make "a abs ((first :pt) - (first first :pts))
make "b abs ((last :pt) - (last first :pts))
if and :a < :close :b < :close [make "pt first :pts ifelse :a > :b [make
"close :a][make "close :b]]
CHECK bf :pts
end
TO MAG ;see above
tto "mask
ifelse :mag = "off [make "mag "on ht][make "mag "off st]
tto "cross
end
TO REPORT ;see above
ifelse :fig = [] [][make "xdist (abs(first last :fig) - (first
mousepos)) set "Xtext "text (word (int :xdist / 6) "' "- round (((:xdist
/ 6) - int (:xdist / 6)) * 12) "") make "ydist (abs(last last :fig) -
(last mousepos)) set "Ytext "text (word (int :ydist / 6) "' "- round
(((:ydist / 6) - int (:ydist / 6)) * 12) "")]
end
TO DRAWFIG :fig ;basic figure drawer
pu setpos first :fig pd
DRWFIG bf :fig
END
TO DRWFIG :fig ;see above
if :fig = [] [pu stop]
setpos first :fig
DRWFIG bf :fig
end
TO TOWARD :pt ;;;sets heading
if (first :pt) = (first pos) [ifelse (last :pt) > (last pos) [seth 0
stop][seth 180 stop]];;;no divide by 0
make "slp ((last :pt) - (last pos)) / ((first :pt) - (first pos))
ifelse (first :pt) > (first pos) [seth minus ((arctan :slp) - 90)] [seth
minus ((arctan :slp) + 90)]
end
;;;(ANG takes 3-pt. list; measures clockwise;
;;; first pt.pair is start'g seg; second pt. is center)
TO ANG :pts
local [hdga hdgb]
setpos first bf :pts
TOWARD first :pts make "hdga heading
TOWARD last :pts make "hdgb heading
ifelse :hdgb > :hdga [make "ang :hdgb - :hdga][make "ang :hdgb + 360 -
:hdga]
end
-----Original Message-----
From: mwforum-admin@lists.mathcats.com
[mailto:mwforum-admin@lists.mathcats.com]On Behalf Of Jeff Knope
Sent: Thursday, January 02, 2003 2:31 AM
To: mwforum@lists.mathcats.com
Subject: [MWForum]figure generator
Daniel Ajoy, et al-
I'm completely new to forums of any sort, and am unsure of the protocol.
I suspect I should be doing a "reply to" - but frankly, what I got in
reply was a huge bunch of stuff: what I'd written, then what I'd written
imbedded in HTML, then Daniel's response, then about 300 lines the first
of which was:
R0lGODlhNgFKAfcAAAQCBPz+/AQC/PwCBEADFzoAAwAA+AAAZAA/gQAZAP8ABxUAAwDvAQAR
the remaining 299 more of the same. If I do a "reply to" you'll just
get all that gibberish right back. So I'm starting over with a clean
piece of paper. If there's some sort of setting for me to make in my
mail program or something, I'd appreciate some help with that.
Maybe all that gibberish had to do with Daniel's attachment, but there
was no paperclip or anything, and I didn't get the attachment.
Anywho, I'm including an attachment of the procedures you asked about
(sans the arc - I'll deal with it separately later), along with some
introductory explanations. I hope it's useful.
Regards,
-JEFF