The message below is being cross-posted from the LogoForum. Please
reply here at comp.lang.logo and it will be cross-posted back to the
LogoForum. The original author of this message is
gerhard.reuteler@[EMAIL PROTECTED]
Mike,
I looked at the beautiful spiro4.jpg! and at your h_plot subprocedure. I
can't figure out where the variable :i gets its value from! I don't
understand how (from which procedure) h_plot is called to produce the
the spiros. Doesn't its output gets lost because there is no
[output :list#] command at the end?
Could you please post the whole program?
Gerhard
Am Sonntag 06 Januar 2008 schrieb Mike Sandy:
> I mentioned previously that the spiro program
> could be extended to any number of vectors. A
> way to do this is with a sub- procedure
>
> to h_plot :list#
> ; :list# = [[length1 angle1][length2 angle2]..]
> if empty? :list#[stop]
> local[d]
> make "d first list#
> vector (first :d) :i+repcount*last :d
> h_plot bf :list#
> end
>
> MAP could be used but with 30000 repeats
> the plot is slower.
>
> A closed curve is generated if the angles
> are integers. If one or more of the angles
> are increased by small amounts e.g. 0.002
> then the curve is no longer closed
> but generates such an image as shown spiro4.jpg.
> The Moiré effects are an additional attraction.
>
> The image was generated using aUCBLOGO.
> If FMSLogo (or MicroWorld Pro) is used,
> aliasing effects spoil the image spiro_fmsl.jpg.
> Elica, I guess could produce as good an
> image as aUCBLOGO, though not as fast.
>
> Mike
>
> ----- Original Message -----
> From: Mike Sandy
> To: LogoForum
> Sent: Friday, January 04, 2008 12:23 PM
> Subject: [LogoForum] Turtle geometry
>
>
>
> John's program for an ellipse is from
> Turtle Geometry; Abelsson & diSessa. It is given in chpter 1,
> but the explanation is not given until vectors are dealt with in
> Chpter 3.
>
> TO ELLIPSE :S :E
> LOCAL "N
> MAKE "N 0
> REPEAT 360[RT :N FD :S LT :N LT :N FD :S * :E RT :N MAKE "N :N + 1]
> END
>
> The explanation using vectors may be of interest. A turtle
> generates a vector whenever it moves i.e. produces a line which has a
> length and a direction!
>
> to vector :length :direction
> seth :direction
> pd fd :length pu
> end
>
> Any two vectors (line segments) can be "added" together to form a
> third vector(line segment). v0 + v1 = v2
> The order of addition is not important: v1 + v0 = v2
>
> A regular polygon consists of a set of vectors of the same length
> but each differing from its neighbour by a fixed angle, which is a
> factor of 360. So the direction of each vector is a multiple of the
> fixed angle.
>
> to poly :length :num_sides
> make "ang 360/:num_sides
> cs
> (repeat :num_sides
> [ vector :length repcount*:ang ])
> end
>
> An important result is such a set of vectors form a closed curve;
> the sum of the vectors is zero (has zero length ).
>
> v1+v2+...+vn = 0 (n is the number of sides)
>
> This means that polygons can be combined. Which is the explanation
> of the ELLIPSE program.
>
> to ellipse :e
> cs ht pu
> plot 2 1 2*:e -1
> end
>
> to plot :s1 :a1 :s2 :a2
> (repeat 360
> [vector :s1 repcount*:a1
> vector :s2 repcount*:a2
> ])
> end
> On its own each vector generates a circle.
>
> The advantage of this program is that it also generates
> spirographs: e.g.
>
> to spiro
> cs ht
> plot 1.4 2.6 1.4 1 ;use REPEAT 5000[..]
> end
>
> The program can be extended further by adding more vectors in the
> REPEAT!
>
> The curves can be smoothed by using two turtles, one to find the
> next point, the other to draw the line.
>
> Mike
__._,_.___
LogoForum messages are archived at:
http://groups.yahoo.com/group/LogoForum


|