Re: [LogoForum] The FILL Command
- From: <Use-Author-Address-Header@[127.1]>
- Date: Thu, 26 Jan 2006 10:06:13 -0800 (GMT-08:00)
The message below is being cross-posted from LogoForum.
Mike,
Just a short note here...BUSY week...to thank you for your thoughtful suggestion. Looks like it will work fine and I'll give it a try this weekend.
George :)
-----Original Message-----
From: Mike Sandy <mjsandy@xxxxxxxxxxxxxx> Sent: Jan 25, 2006 3:52 AM To: LogoForum@xxxxxxxxxxxxxxx Subject: Re: [LogoForum] The FILL Command
Oops; the output from my previous program was the number of recursive calls. Here is the corrected program:
to aa :n :size ; :n - number of sides of polygon ; :size - side length of polygon ; cs bitload "boundary.bmp pu ht setpc 0 local[theta phi p_radius r.total] make "r.total 0 make "theta 360/:n make "phi (90-:theta/2) make "p_radius :size/(2*cos :phi) rt 180-:phi fd :p_radius lt 180-:phi tile 1 (show "|Number of polygons used = | :r.total "FINISHED) end
to poly :dir local "p pd (repeat :n [fd :size lt :dir*:theta]) pu setfc ifelse :dir<0[2][4] make "p list pos heading lt :dir*:phi fd :p_radius fill make "r.total :r.total+1 setpos first :p seth last :p end
to probe? :dir local [p c] make "p list pos heading lt :dir*:phi fd :p_radius make "c pixel=7 ;(and pixel=7 :radius>distance [0 0]) setpos first :p seth last :p op :c end
to tile :dir ifelse probe? :dir [poly :dir][stop] (repeat :n [tile -1*:dir fd :size lt :dir*:theta ])
end
By modifying the above the number of pixels enclosed within a boundary can be found, but the relationship between this number and the enclosed area is not simple!
to aa cs bitload "boundary.bmp pu ht setpc 0 localmake "r.total 0 tile 1 (show "|Number of pixels present = | :r.total "FINISHED) end
to tile :dir ifelse pixel=7 [setpixel 4 make "r.total :r.total+1][stop] (repeat 4 [tile -1*:dir fd 1 lt :dir*90 ])
end
For both programs a thick boundary line is advisible. Mike
---- Original Message ----- From: "gvandemark1" <gvandemark@xxxxxxxxxxxxx> To: <LogoForum@xxxxxxxxxxxxxxx> Sent: Tuesday, January 24, 2006 4:54 AM Subject: [LogoForum] The FILL Command
I am trying to develop a method for determining the "area" of an irregular shape. When the FILL command is called to fill in an enclosed space, does it return a value representing the number of pixels that were filled?
If not, is there any way to compute, at least approximately, the number of pixels within a fill area?
Thanks in advance for your help.
LogoForum messages are archived at: http://groups.yahoo.com/group/LogoForum
.
- Prev by Date: Programming in mswlogo can be surprising
- Next by Date: Re: [LogoForum] [ANN] Liogo 0.2 is available
- Previous by thread: Re: [LogoForum] The FILL Command
- Next by thread: [LogoForum] Re: shape
- Index(es):
Relevant Pages
|