the points of graphic

Jim Hurley jhurley0305 at sbcglobal.net
Sun Jan 19 12:09:54 EST 2014


Hi Roger,

Praying on my ego are you?

I don't really think I am up to this challenge. I'm not quite sure what is needed.

But here's a thought. It sounds like joining all these disparate parts together to form a whole might be helpful. After all, all graphics drawn with the pencil, line, curve... tools are just a bunch of joined line segments. If you have a bunch of such independent such groups, i'm guessing that putting them together might help form the "single new polygon" you speak of would be useful.

This stack below show how to join any two graphic segments without changing their individual shapes. It uses the handler:

JoinLines "line1", "line2"

It preserves the length and angle of each.

Repeated used of this command will put all your elements together. As in:

   repeat with i = 1 to N-1
      joinLines "line" & i , "line" & i+1
   end repeat

Of course you will have to define the order in which they are to be joined.

  go url "https://dl.dropboxusercontent.com/u/47044230/Set%20angle%20and%20join%20lines.livecode"

I think I posted a stack that makes uses of these "Line Tools", some time ago. RIght now all you  can do is set the points and the location. But it would be useful on occasions to set the length and angle, and possibly join them together without changing the shape of the bits and pieces. So here it is again:

  go url "https://dl.dropboxusercontent.com/u/47044230/Line%20properties%20final.livecode"

Some of the applications in  that stack are a bit frivolous, frivolous but fun, like shattering a circle and reforming the bits and pieces into a rectangle.

Jim



> Message: 10
> Date: Sat, 18 Jan 2014 11:20:02 -0500
> From: Roger Eller <roger.e.eller at sealedair.com>
> To: How to use LiveCode <use-livecode at lists.runrev.com>
> Subject: Re: the points of graphic
> Message-ID:
> 	<CAAT6EXMZwKpKE3w0Ah4aU0dpQTkfhdc4+fQEr3eGJDkHRSFw4A at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
> 
> Jim (aka Mr. graphics wizard),
> 
> Here's a challenge for you:
> 
> Create the outline of an odd geometric shape using several of the existing
> tools (an L shape, but with round ends, by using circles).
> 
> Then, with math wizard code, trace the outer overall shape into the points
> of a single new polygon.
> 
> THAT would be uber-useful!
> 
> ~Roger
> On Jan 18, 2014 11:04 AM, "Jim Hurley" <jhurley0305 at sbcglobal.net> wrote:
> 
>>> 
>>> Message: 2
>>> Date: Fri, 17 Jan 2014 16:00:43 +0200
>>> From: jbv at souslelogo.com
>>> To: use-revolution at lists.runrev.com
>>> Subject: the points of graphic
>>> Message-ID: <b058292c0d6ba33b59b2906da17e9271.squirrel at 185.8.104.234>
>>> Content-Type: text/plain;charset=iso-8859-1
>>> 
>>> Hi list,
>>> 
>>> Is there a way to get the points of a Regular Polygon
>>> graphic, or do I have to compute it myself using the
>>> loc, width, height and number of sides of the graphic ?
>>> 
>>> Thanks,
>>> jbv
>>> 
>>> 
>> 
>> This script will provide the individual points.
>> 
>> on mouseUp
>>   put the width of this card/2 into x0
>>   put the height of this card/2  into y0
>>   put 6 into n
>>   put 50 into L
>>   put 360/n into tAngle
>>   put x0,y0 & cr after tPoints
>>   set the points of grc "polygon" to tPoints
>>   repeat with i = 1 to n+1 -- plus 1 to close
>>      --Calculate each line segment individually
>>      --dx and dy and the x and y projections of the line segment
>>      repeat with j = 1 to i
>>         add  L * cosine(j*tAngle) to dx
>>         subtract    L * sine(j*tAngle) from dy
>>      end repeat
>>      put x0 + dx , y0 + dy into theCoord[i] --if you want the coordinates
>> of each vertex
>>      put (x0 + dx), ( y0 + dy) & cr after tPoints
>>      set the points of grc "polygon" to tPoints--if you want to see the
>> polygon evolve
>>      put 0 into dx
>>      put 0 into dy
>>   end repeat
>> end mouseUp
>> 
>> Given the individual points (theCoord[i]), it would be possible to do
>> things line draw all diagonals, connect each vertex with all the others.
>> When n is large, it is a pretty picture.
>> 
>> But, of course, there is always the much simpler Turtle Graphics.
>> 
>> To poly n, L
>> repeat n
>>  forward L
>>  left 360/n
>>  put xycor() into theVertex[i]
>> end repeat
>> end poly
>> 
>> 
>> 
>> _______________________________________________
>> 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