use-livecode Digest, Vol 123, Issue 56

Roger Guay irog at mac.com
Tue Dec 31 12:27:28 EST 2013


Excellent, Jim! This certainly make a good case for TG.

Thank you!

Roger


On Dec 31, 2013, at 8:51 AM, James Hurley <jhurley0305 at sbcglobal.net> wrote:

>> 
>> Message: 12
>> Date: Mon, 30 Dec 2013 19:04:04 -0700
>> From: Roger Guay <irog at mac.com>
>> To: How to use LiveCode <use-livecode at lists.runrev.com>
>> Subject: Re: Flow/wrap text into an irregular shape
>> Message-ID: <EF2CF37D-27DD-47AA-9F23-C3C5920943CB at mac.com>
>> Content-Type: text/plain; charset=windows-1252
>> 
>> Jim,
>> 
>> Could you please briefly explain this distinction between Euclidian and Cartesian geometry as it applies to Turtle Graphics?
>> 
>> Thanks,
>> 
>> Roger
>> 
>> 
>> On Dec 30, 2013, at 10:08 AM, James Hurley <jhurley0305 at sbcglobal.net> wrote:
>> 
>>> The basic advantage of TG is that it speaks a language closer to Euclidian than Cartesian geometry.  
>> 
> 
> 
> Hi Roger,
> 
> Good question. Best answered with an example. Euclidean geometry is concerned with shapes (lines and angle), while Cartesian geometry is concerned with points in a Cartesian coordinate system. 
> 
> A script for a Cartesian polygon might look like this:
> 
> on mouseUP
>   drawPolygon 6,100
> end mouseUP
> 
> on drawPolygon N, L
>   --draw an N side polgon with sides of length L
>   set the points of grc "poly" to ""
>   put trunc( the width of this card/2) into x0
>   put trunc( the height of this card/2) into y0
>   put x0 into xOld
>   put y0 into yOld
>   put 0 into tAng
>   repeat N+1
>     —Draw each side relative to its predecessor
>      put xOld + L* sin(tAng*pi/180) into xNew
>      put yOld + L * cos(tAng*pi/180) into yNew
>      put xNew,yNew & cr after tPoints
>      put xNew into xOld
>      put yNew into yOld
>      add 360/N to tAng
>      —set the points of grc “poly” to tPoints; Use this if you want to see the polygon evolve
>   end repeat
>   set the points of grc "Poly" to tPoints
> end drawPolygon
> 
> That script is full of Cartesian coordinates and trig.
> 
> The same polygon may her accomplished in TG with something like this:
> 
> on drawPolygon N, L
>   startTurtle --
>   repeat N 
>      forward L
>      left 360/N
>   end repeat
> end drawPolygon
> 
> The script if nothing but lengths and angles.
> One might a easily construct a handler to draw an N sided polygon whose circumference is C:
> 
> on drawPolygonGivenCircumference N, C
>  st
>  repeat N
>    fd C/N
>    left 360/N
>  end repeat
> end drawPolygonGivenCircumference 
> 
> Of course RunRev recognized the complexity of analytic, cartesian geometry in such cases and introduced several drawing tools: Rectangle, Line, Oval, Freehand curve, Polygon, Regular polygon, to deal with these special cases.
> 
> But I have also built into TG the ability to handle Cartesian geometry as well, with such functions as xCor(), yCor(), xyCor(), direction(), etc. for there are times when that is the best route to take. How else would one draw a parabola. (y = x^2)
> 
> Jim
> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the Use-livecode mailing list