Polygon Side Does Note Match to Polygon rect

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Polygon Side Does Note Match to Polygon rect

Stephen Barncard via use-livecode
Regular Polygon Tool:

If you create a triangle grc and set its width and height to 243pt

the tool positions the top of the triangle to center of the top line of the rect and leaves margins on the left and right sides. Thus, the triangle itself doesn't take the width of 243pt. It like ist has margins left and right…

how to does have precise control over the size of the triangle (not the rect)?

right now I have to build a "measuring grc/ruler" underneath, set it width to 243, and fiddle with the triangle until it matches my "ruler"

BR


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Polygon Side Does Note Match to Polygon rect

Stephen Barncard via use-livecode
The center (loc) of the rect is the center of the triangle.  So to get a triangle of width W, you need to set the height and width of the grc to 2*W/sqrt(3).

Thanks,
Brian
On Dec 27, 2019, 10:31 AM -0500, Sannyasin Brahmanathaswami via use-livecode <[hidden email]>, wrote:

> Regular Polygon Tool:
>
> If you create a triangle grc and set its width and height to 243pt
>
> the tool positions the top of the triangle to center of the top line of the rect and leaves margins on the left and right sides. Thus, the triangle itself doesn't take the width of 243pt. It like ist has margins left and right…
>
> how to does have precise control over the size of the triangle (not the rect)?
>
> right now I have to build a "measuring grc/ruler" underneath, set it width to 243, and fiddle with the triangle until it matches my "ruler"
>
> BR
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Polygon Side Does Note Match to Polygon rect

Stephen Barncard via use-livecode
In reply to this post by Stephen Barncard via use-livecode
Can you set the margins to 0?

Bob S


> On Dec 27, 2019, at 07:30 , Sannyasin Brahmanathaswami via use-livecode <[hidden email]> wrote:
>
> Regular Polygon Tool:
>
> If you create a triangle grc and set its width and height to 243pt
>
> the tool positions the top of the triangle to center of the top line of the rect and leaves margins on the left and right sides. Thus, the triangle itself doesn't take the width of 243pt. It like ist has margins left and right…
>
> how to does have precise control over the size of the triangle (not the rect)?
>
> right now I have to build a "measuring grc/ruler" underneath, set it width to 243, and fiddle with the triangle until it matches my "ruler"
>
> BR

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Polygon Side Does Note Match to Polygon rect

Stephen Barncard via use-livecode
In reply to this post by Stephen Barncard via use-livecode
A triangle with width=height is NOT a regular polygon (it doesn't have equal side length).

To have what you want create a grc of type "polygon" and then

set points of grc 1 to "0,0,10,-10,20,0,0,0"
set width of grc 1 to 243
set height of grc 1 to 243

To have equal sideLength you set the width to 243/sin(pi/3).


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Polygon Side Does Note Match to Polygon rect

Stephen Barncard via use-livecode
In reply to this post by Stephen Barncard via use-livecode
This is similar to a problem I've had with hexagons.

Probably the best thing is NOT to use the Regular Polygon Tool but to
define your own triangles using a Polygon Graphic where you set the points.

Richmond.

On 27.12.19 17:30, Sannyasin Brahmanathaswami via use-livecode wrote:

> Regular Polygon Tool:
>
> If you create a triangle grc and set its width and height to 243pt
>
> the tool positions the top of the triangle to center of the top line of the rect and leaves margins on the left and right sides. Thus, the triangle itself doesn't take the width of 243pt. It like ist has margins left and right…
>
> how to does have precise control over the size of the triangle (not the rect)?
>
> right now I have to build a "measuring grc/ruler" underneath, set it width to 243, and fiddle with the triangle until it matches my "ruler"
>
> BR
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Polygon Side Does Note Match to Polygon rect

Stephen Barncard via use-livecode
In reply to this post by Stephen Barncard via use-livecode
@HH @brian

Ha! You math genius are wonderful! But this is a one off design process, so I will still with my "ruler" grc rect….


A triangle with width=height is NOT a regular polygon (it doesn't have equal side length).

To have what you want create a grc of type "polygon" and then

set points of grc 1 to "0,0,10,-10,20,0,0,0"
set width of grc 1 to 243
set height of grc 1 to 243

To have equal sideLength you set the width to 243/sin(pi/3).


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Polygon Side Does Note Match to Polygon rect

Stephen Barncard via use-livecode
In reply to this post by Stephen Barncard via use-livecode
> BR wrote:
> But this is a one off design process, so I will still with my "ruler" grc rect….

Obviously you want an evenly sided triangle with fixed width W? So use

put 243 into W -- for example
set points of grc 1 to "0,0,10,-10,20,0,0,0" -- these are start-values only
set width  of grc 1 to W
set height of grc 1 to W*sin(pi/3) -- note: 243*sin(pi/3)=210
set loc of grc 1 to 150,150 -- adjust to your needs

What's easier than that?


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Polygon Side Does Note Match to Polygon rect

Stephen Barncard via use-livecode
Thanks Howard, I have a "design tools" stack, which I can toggle as a palette, focus on the top card of the stack I am building.. I'll add a card with this in a button

"Make equilateral triangle"

BR

Obviously you want an evenly sided triangle with fixed width W? So use

put 243 into W -- for example
set points of grc 1 to "0,0,10,-10,20,0,0,0" -- these are start-values only
set width  of grc 1 to W
set height of grc 1 to W*sin(pi/3) -- note: 243*sin(pi/3)=210
set loc of grc 1 to 150,150 -- adjust to your needs

What's easier than that?
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode