Converting Regular graphics in Polygon graphics

Alejandro Tejada capellan2000 at yahoo.com
Mon Mar 24 00:12:01 EST 2003


Hi fellow list members,

I was working in the code to convert regular
graphics in polygon graphics.
You can see the results in the following file:

http://groups.yahoo.com/group/metacard/files/export_regular_polygons.zip

You need to have a Yahoo account to download
from this group, so a Temporal File area will be
a nice addition to this list, too.

When you open the file you will notice that
there is a big regular graphics in the center
of the stack. A smaller graphic is at the left.

You change the number of sides
using the blue popUp button at the right.
The slider lets you change the angle of the
graphic. Additionally, when you change the angle,
a mouseUp msg is sent to the center regular graphic
and an outlined black line polygon graphic is draw
around this graphic.
As the outline of both graphics are not the same
colors, you will notice the slightest differences
between both.
Although, is almost exact for some angles and some
sides, you'll notice when not.

But the real problem is the small regular graphic.
This graphic was scaled so the polygon that draws
around it has to rescale itself and this is were the
problems begun.

A regular graphic is draw inside a circle, so his rect
includes the circle that surround it.

When I set the rect of the Polygon graphic to the
rect of the regular graphic, the result is a
graphic identically proportional but always bigger.

The question is:

How can I rescale the polygon graphic to fit exactly
over the NON proportional scaled regular graphic?

In a first attempt, I made a code to fit the
Polygon over a regular graphic of 6 sides.
It works well for some angles, but not for others.
I have not included this code in this file,
but if you want to give it a try, I'll
send you or post in the list.

In my limited math knowledge, a code that works
in every situation (all angles for all number of
sides) must require to know "exactly" where the
vertex fall in the area of the regular graphic.
Only in certain angles the vertex of some graphics
touch the edges of the rectangle. This is the ideal
situation.

Any help in this area is welcome,

Thanks in advance.

Alejandro





=====
Useful sites:
http://www.sonsothunder.com/devres/metacard/tips/ and /revolution/tips/
http://lists.runrev.com/pipermail/metacard/ and /use-revolution/
http://wiki.macitworks.com/revdocs
http://www.google.com/advanced_search?q=site:lists.runrev.com

__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com



More information about the use-livecode mailing list