[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LOGO-L> David's Star and List Processing



Hi all,

Thought you might like to see the work that the posts a few weeks ago
on David's Star stimulated for us.

We were interested to see Frank Caggiano's comment re string art (13 June '98):

"Actually once the technique of drawing via list processing is mastered
it lends itself to many interesting images."

Seems to us these stars would have been tricky to generate without it.

At a simpler level, we find part of the problem when teaching Logo is
how to introduce list processing - text based work generally seems
rather sterile in comparison to the turtle.

But the power of a list to generate repetitive images seems a very powerful
way into it.
---------------------

Back to David's Star :

Three fold symmetry seems to be the only way, but there are four possible
methods, excluding two reflections. (and only four ?)

The previously suggested three methods (cstar, funnystar and sigma) all
draw the same route around the star, but starting from different points.
The following procedures show the result of moving the starting point
around the star to generate the four methods.

The starting point for each colour moves one position clockwise in each
of the stars.

Star A is the cstar. Star D is the sigma.
These are not repeated as they have mirror symmetry.

Star C is the funnystar solution, with its mirror image.
Star B is a different one from any posted, we think, and this also has
a mirror image.

------------------------

We also looked at the equivalent star based on other polygons. The
approach of looking for a single path around the entire star doesn't
work in some cases.  For any odd-sided polystar (tristar, pentastar,
heptastar etc.) such a path exists.  Take the two sides of a stellation
and the next side along to the right and repeat this basic figure around
the polygon.  Trying this on a pentagon you should see that the star is
drawn in two phases, with the second phase filling the gaps missed by the
first phase.

With even-sided polygons, however, the first phase creates a loop which
may not encompass the entire star.  Trying this on a square gives a
hexagonal loop (apologies for the dodgy ASCII art :-):

     ___ ...
    |  .\  .
    | .  \ .
    |.    \.
    .\    .|
    . \  . |
    ...\.__|

In this case, you can draw the other loop to fill the gaps, but there
is no figure which can be repeated to draw the stellated square without
an offset each time.

For even-sided stars which are not multiples of four, the cstar
(stellation, two internal sides, stellation) will draw the entire shape.
(requires a little thought to see why).

Hypothesis: There is no figure made from n equal length lines which will
draw a polystar of this type such that n is not a multiple of 3.

Can anyone prove or disprove this?

(eg. in all of the figures for the hexastar, n is six)

---------------------
Hope that hasn't bored you all too much!
---------------------
Procedures for MSWLogo follow :
---------------------
to aa						; main procedure - enter aa to run
 constellation 40			
end

to constellation :s				; :s = side length of inner hexagon
  cs ht setsc [0 0 0] setpensize [4 4]		; set up screen
  drawstars :s [120 0 60 0 120 300] [] 1		; draw
end

to drawstars :s :vislist :invislist :star
  ifelse :star < 7 [				; for stars 1 to 6 ...
        pu setxy -(:s *cos 30) (0.5 * :s * cos 30) seth 0	; move to start position
        rt 60 * (:star - 1) fd :s *4 seth 0			; move to start of star
        labels							; write labels
    foreach :invislist [fd :s rt ?] 			; move to first drawing position by
							; drawing invisible edges
    pd
      repeat 3 [					; for three figures ....
      setcol repcount       				; set pencolour
      foreach :vislist [				; draw visible edges of
							; 6 figure segments
                            fd :s				
                            rt ?				; use next item of :vislist
                            wait 5
                            ]
                   wait 20
                   ] 
     wait 60
    ;
    drawstars :s (rotate :vislist) (lput (first :vislist) :invislist) (:star + 1)
						; move to next star and draw it ...
						; rotating visible segments list
						; and incrementing invisible segments list
  ] [pu home st]
end

to labels						  ;labels each star
 pu  move (:s *0.6) (-2*:s)  setpc [255 0 0] rt 90	  ; move to position of label
 label (item (ifelse :star > 4 [8 - :star] [:star]) "ABCD); chooses letter and labels screen
 lt 90 move (-:s *0.6) (2*:s)
end

to move :x :y
fd :y rt 90 fd :x lt 90
end

to rotate :l				  ; rotates visible segment list ...					
  output (lput (first :l) (butfirst :l))  ; [120 0 60 0 120 300] to [300 120 0 60 0 120] etc
end

to setcol :t
  if :t = 1 [setpc [0 0 255]]
  if :t = 2 [setpc [0 255 0]]
  if :t = 3 [setpc [255 0 0]]
end

-------------

Cheers 
-- 
Geof and Tom Lynn
---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org.  Mail
questions about the list administration to logofdn@gsn.org.  To
unsubscribe send    unsubscribe logo-l    to majordomo@gsn.org.



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home