Challenge: How can we set the rect of a polygon to its visual rect? (and a tentative solution)
capellan
capellan2000 at yahoo.com
Sat Aug 15 19:56:10 EDT 2009
Hi Wilhelm,
Wilhelm Sanke, FB01 wrote:
>
> Could it be that "the option to crop" is contained in a different
> version of your stack?
>
This the part of the script that crop the image to
the size of the user created cropping rectangle:
if cropImage = "true"
then
repeat until foundGraphic = 1 -- or qfl = the number of lines of
tSelection
put line qfl of tSelection into tGraphic
if qfl = the number of lines of tSelection then put 1 into
foundGraphic
if word 1 of tGraphic is "graphic" and the forecolor of tGraphic =
cropColor
then
put 1 into foundGraphic
set the name of tGraphic to "tCropGraphicRectangle"
set the layer of graphic "tCropGraphicRectangle" to the layer of
tMaskedImage + 1
put the rect of graphic "tCropGraphicRectangle" into zxy
do "crop" && tMaskedImage && "to" && zxy
else
add 1 to qfl
end if
end repeat
end if
Wilhelm Sanke, FB01 wrote:
>
> The question is, how do you compute the points of a polygon (that will
> extend to the full size of the rect of a regular polygon without
> differences between rect and visual rect) if you do not have a normal
> polygon as a template?
>
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
on mouseUp
if the hilite of btn "Leave Trails" is false
then
repeat with i = the number of grcs of this stack down to 3
if the name of graphic i contains "Test"
then next repeat
else delete grc i
end repeat
end if
-- if fld "sides" is a number then set the polysides of me to fld "sides"
set the polysides of me to the short name of btn id 2114
put the polysides of me into asdfg
put 360/asdfg into regularPolygonAngle
if fld "grcangle" is a number and fld "grcangle" < 361 then set the angle
of me to round(fld "grcangle")
put the angle of me into qwerty
put item 1 of the loc of me into mX
put item 2 of the loc of me into mY
put the rect of me into lkjhg
put abs(item 1 of lkjhg - item 3 of lkjhg) into plm1
put abs(item 2 of lkjhg - item 4 of lkjhg) into plm2
if plm1 <> plm2
then
if plm1 > plm2
then
put (plm1 / 2) into polarRadius
else put (plm2 / 2 ) into polarRadius
else
put (plm1 / 2) into polarRadius
end if
if fld "exact" is a number then put polarRadius - fld "exact" into
polarRadius
-- this is very interesting, because this operation make the figure more
exact!
repeat with i = 1 to asdfg -- the sides of the reg poly
put (regularPolygonAngle * i) + qwerty into ang
put (ang * pi )/ 180 into radians
-- find rectangular coordinates of ( polarRadius,radians)
if the hilite of btn "Use statRound" is true
then
put statround(mX + (polarRadius * cos (radians))) & "," after rfv
put statround(mY + (polarRadius * sin (radians))) & return after rfv
else -- the hilite of btn "Use round"
put round(mX + (polarRadius * cos (radians))) & "," after rfv
put round(mY + (polarRadius * sin (radians))) & return after rfv
end if
end repeat
put item 1 of the first line of rfv,item 2 of the first line of rfv after
rfv
-- put line 1 of rfv after rfv -- using this line produces an strange bug on
-- polygons of 8 sides. It puts letters instead of numbers in the last line
set the style of the templategraphic to polygon
create grc
set the points of it to rfv
-- set the rect of it to the rect of me -- lkjhg
if the hilite of btn "Put Points into Msg" is true then put rfv
choose browse tool
end mouseUp
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
--
View this message in context: http://www.nabble.com/Re%3A-Challenge%3A-How-can-we-set-the-rect-of-a-polygon-to-its-visual-rect--%28and-a-tentative-solution%29-tp24988110p24989177.html
Sent from the Revolution - User mailing list archive at Nabble.com.
More information about the use-livecode
mailing list