Challenge: How can we set the rect of a polygon to its visual rect? (and a tentative solution)

Wilhelm Sanke sanke at hrz.uni-kassel.de
Sun Aug 16 16:46:12 EDT 2009


On Sat Aug 15, 2009, capellan capellan2000 at yahoo.com wrote:
 
> Hi Wilhelm,
>
> (snip)
> Some time ago, i posted a stack named "export_regular_polygons"
> than shows a formula to convert regular polygons (3 to 20 sides)
> in polygons:
>
> http://www.geocities.com/capellan2000/export_regular_polygons.zip
>
> Wilhelm Sanke, FB01 wrote:
> >
> > I conclude: I think it should be a relatively easy task for the
> > programmers of Revolution (or Transcript, RevTalk etc.) to abolish the
> > inconsistency of regular polygons of  having different sizes for visual
> > rects and their proper rects as a graphic.
> >
>
> i agree. if you fill an enhancement request in the Runrev Quality
> Control Center, i will vote for it.
>
> Have a nice weekend.
>
> al

Hi al (or "Al" - or whatever is behind "al" - but no need to out yourself),

Amazing! Your stack indeed really "crops" a regular polygon and converts 
it to a normal polygon.

This - your approach to the conversion - was exactly what I was looking 
for and had imagined to be feasible.

I took the liberty to set the lockloc of grc "Test" to false to see how 
your script handles regular polygons when the polygon is being 
"distorted", i.e. when the angles of the regular polygon are not 
identical. In this case your script nevertheless determines the points 
for the normal polygon on the basis of an ideal shape of the regular 
polygon with identical angles, but at the same time considering the set 
angle (the possibly rotated angle of the whole polygon) of the regular 
polygon.
This "ideal" form of the converted polygon could of course then be 
distorted manually to be identical with the visual shape of the regular 
polygon. I assume this part of the conversion could also be scripted?--

Just to mention it for the sake of completeness, my own way to convert 
regular to normal polygons has been a simple "hands-on" approach - like 
in the case of cropping an image to its visual rect, which I had 
described in an earlier post:

- I either have traced the regular polygon with the free-hand polygon 
tool, which procedure needs a steady hand and in most cases later 
fine-tuning of the gained points for the polygon, or

- I clicked at the vertexes of the regular polygon ("put the mouseloc") 
to establish the points for the normal polygon, which also may need some 
fine-tuning afterwards.--

I believe that the Rev engine internally must know the values of the 
vertexes of a regular polygon, otherwise it would not be able to display 
the shape of a regular polygon, both in its ideal and distorted form.
So, the task for the Rev team to produce an enhancement that would make 
it possible to reduce the rect of a polygon to its visual rect would be 
simply to make the values of the vertexes available and retrievable, and 
then let the user choose to set the style of the polygon to "polygon" 
based on the given points/vertexes.

Best regards,

Wilhelm
<http://www.sanke.org/metaMedia>




More information about the use-livecode mailing list