Rotating Polygons

2005-03-28 Thread Rick Harrison
Hi there,
I'm trying to rotate some simple squares and grouped polygon
objects around a normal center point.
I can't seem to get it to work.  The examples in the documentation
don't seem to work or make logical sense to me either.
Has anyone done this?  It seems like it should be a simple thing to do.
Thanks in advance!
Rick Harrison
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Rotating Polygons

2009-09-30 Thread Richmond Mathewson

I just have been reading Robert Cailliau's page:

http://www.robertcailliau.eu/Programming/Revolution/Tutorials/zTutorials.html

I popped together a stack containing a Heptagonal regular
polygon and popped this in a button:

on mouseUp
  set the Angle of grc "HEPT" to 45
end mouseUp

in RunRev 4 that seems to work perfectly well ...

also works perfectly in Dreamcard 2.6.1 

This doesn't work for a a non-regular polygon graphic:

Cailliau claims:

"Unlike images, polygons cannot be directly rotated in Revolution.  They 
have no "angle" property."


http://www.robertcailliau.eu/Programming/Revolution/Tutorials/PolygonRotation/zPolygonRotation.html

the second part of which is plain WRONG; one can set the ANGLE of an 
irregular polygon, it just doesn't

have any affect.

HOWEVER, the Documentation explicitly details  revRotatePoly:

on mouseUp
  revRotatePoly the long ID of grc "SQUIGGLE", 60
end mouseUp

which is a lot simpler than getting misled by Cailliau's stuff about 
having to use all sorts of complicated

custom properties.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


RE: Rotating Polygons

2005-03-28 Thread MisterX
Hi Rick,

You'll find a stack with a ton of different examples to do that at

http://www.monsieurx.com/modules.php?name=News&file=article&sid=164

SonOfThunder software also has a nice example for images...
http://www.sonsothunder.com/devres/revolution/revolution.htm

cheers
Xavier 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Rick Harrison
> Sent: Tuesday, March 29, 2005 07:59
> To: How to use Revolution
> Subject: Rotating Polygons
> 
> Hi there,
> 
> I'm trying to rotate some simple squares and grouped polygon 
> objects around a normal center point.
> 
> I can't seem to get it to work.  The examples in the 
> documentation don't seem to work or make logical sense to me either.
> 
> Has anyone done this?  It seems like it should be a simple 
> thing to do.
> 
> Thanks in advance!
> 
> Rick Harrison
> 
> ___
> use-revolution mailing list
> use-revolution@lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 

___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Rotating Polygons

2005-03-29 Thread Rick Harrison
On Mar 29, 2005, at 2:39 AM, MisterX wrote:
Hi Rick,
You'll find a stack with a ton of different examples to do that at
http://www.monsieurx.com/modules.php?name=News&file=article&sid=164
SonOfThunder software also has a nice example for images...
http://www.sonsothunder.com/devres/revolution/revolution.htm
cheers
Xavier

Xavier,
Your link to download "pie control" doesn't work - 404 error.
"Pie control" is a locked stack from your description, and it is
shareware if I want to look at the code.  You site also doesn't
tell me what the cost is if I want to purchase it.
I'm trying to rotate polygons - not images.
Thanks for replying..
Rick
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Rotating Polygons

2005-03-29 Thread Alex Tweedly
Rick Harrison wrote:
Hi there,
I'm trying to rotate some simple squares and grouped polygon
objects around a normal center point.
I can't seem to get it to work.  The examples in the documentation
don't seem to work or make logical sense to me either.
Has anyone done this?  It seems like it should be a simple thing to do.
I hadn't done it until now.  In fact, I hadn't even noticed 
revRotatePoly at all.  (So, thanks !!)

I had a play with it, and managed to get it to work; I created a new 
stack, created a "freehand polygon", and then in the message box typed

  revRotatePoly the name of graphic "Graphic 1", 45
and the polygon did indeed rotate by 45 degrees. However, this produces 
the resulting polygon rotated such that it occupies the same location in 
screen co-ordinates (i.e. same topLeft as the original polygon).

If you want to rotate a number of polygons around a common centre point, 
you'd need to do this, then calculate the appropriately rotated topLeft 
point and set that. I thought it would be easier to simply convert the 
code to do what we want directly, so I copied the revRotatePoly code 
from the Rev scripts, and modified it as below.  (It's in button 
"revCommon" backscript if you want to see the original code).

NOTE - the docs say that we are welcome to read, use and modify this 
code - but that once modified, it is completely unsupported. Sounds 
perfectly reasonable to me :-)

Here is a new handler myRotatePoly which takes a graphic (polygon), and 
angle and a centre point around which the polygon should be rotated.  It 
has been (somewhat) tested; if you have any trouble, let me know and 
I'll put this simple test stack up on RevOnline  but it is just a 
simple stack with one button and one graphic (freehand polygon).

on mouseUp
  myRotatePoly the name of graphic "Graphic 1", -45,250,200
end mouseUp
on myRotatePoly pGraphic, pAngle, basex, basey
  put the topLeft of pGraphic into tTopLeft
  put myPoints(pGraphic, basex, basey) into tPoints-- returns the 
list of points, realtive to the base point
  put the loc of pGraphic into tLoc
  put sin(pAngle * (pi / 180)) into tSinAngle
  put cos(pAngle * (pi / 180)) into tCosAngle
  put (number of items of tPoints) div 2 into tNumItems
  repeat with i = 1 to tNumItems
put (item (i + (i - 1)) of tPoints) into tCurrentH -- + item 1 of 
the center
put (item (i + i) of tPoints) into tCurrentV -- + item 2 of the center
put trunc((tCosAngle * tCurrentH) - (tSinAngle * tCurrentV)) into 
tTempH
put trunc((tSinAngle * tCurrentH) + (tCosAngle * tCurrentV)) into 
tTempV
put tTempH + basex into tCurrentH -- and add back the base x and y
put tTempV + basey into tCurrentV
put tCurrentH,tCurrentV & comma after tFinalPoints
  end repeat
  delete last char of tFinalPoints
  set the points of pGraphic to tFinalPoints
--  set the topLeft of pGraphic to tTopLeft
end myRotatePoly

function myPoints pGraphic, basex, basey
  put the number of lines in the points of pGraphic into tNumPoints
  put empty into tResult
  --  put item 1 of loc of pGraphic into tStartlH
  --  put item 2 of loc of pGraphic into tStartV
  put the points of pGraphic into tPoints
  put basex into tStartlH
  put basey into tStartV
 
  replace cr with comma in tPoints
  if last char of tPoints is comma then delete last char of tPoints
  repeat with i = 1 to tNumPoints
put (item (i + (i - 1)) of tPoints) - tStartlH into tCurrentH
put (item (i + i) of tPoints) - tStartV into tCurrentV
put tCurrentH,tCurrentV & comma after tResult
  end repeat
  delete last char of tResult
  return tResult
end myPoints
btw - remember that this rotation loses accuracy - because of the trunc 
to integer coordinates - so repeatedly transforming the same polygon 
will not, in general, get you back to the original polygon. You may need 
to keep a pristine copy somewhere, and copy the points / rotate the poly 
each time, to prevent the polygon from degrading after multiple rotations.

--
Alex Tweedly   http://www.tweedly.net

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.4 - Release Date: 27/03/2005
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


RE: Rotating Polygons

2005-03-29 Thread MisterX
Nice Alex,

I didn't know that rev handler existed! ;)

To avoid the precision problem, just keep the original coordinates
unrotated.

It's ok for scale or translations but not for rotations. Do the rotation on
a copy of the original object and not the last rotated set. So you only get
just one precision approximation. 

Im too am working on a vector graphic library! ;)

get the short id of graph x
get polyPointArray[polyid] -- x,y[,z,...] table, ndim array

-- get move deltas and offsets from original, not last position...

get MovePoly([moveOffsetXYZ] [,pointsArrayXYZ]
get ScalePoly([ScaleXYZ] [,pointsArrayXYZ][,centerXYZ,]
get SlantPoly([rotationXYZ] [,pointsArrayXYZ][,centerXYZ]
get RotatePoly([rotationXYZ] [,pointsArrayXYZ][,centerXYZ]
put it into graph x

Precomputing helps for speed issues too...

Hope that helps ;)

Cheers
Xavier
--
http://monsieurx.com/runrev

___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Rotating Polygons

2005-03-29 Thread Alejandro Tejada
on Tue, 29 Mar 2005 
Rick Harrison wrote:

> I'm trying to rotate some simple squares and grouped
> polygon
> objects around a normal center point.
> 
> I can't seem to get it to work.  The examples in the
> documentation
> don't seem to work or make logical sense to me
> either.
> 
> Has anyone done this?  It seems like it should be a
> simple thing to do.

Hi Rick,

Visit my site and download this stack:



This stack shows how to use matrices to modify
the scale, rotation and position of vector graphics.

al

Visit my site:
http://www.geocities.com/capellan2000/



__ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Rotating Polygons

2009-09-30 Thread BNig

Richmond,

you might want to try to put 

on scrollbarddrag scrollbarDragValue
revRotatePoly the long ID of grc "SQUIGGLE", scrollbarDragValue
end scrollbardrag

into a scrollbar and scroll a couple of times from 0 to 360 and back.

Robert is up to a stable rotate

regards
Bernd




Richmond Mathewson-2 wrote:
> 
> I just have been reading Robert Cailliau's page:
> 
> 
> Cailliau claims:
> 
> "Unlike images, polygons cannot be directly rotated in Revolution.  They 
> have no "angle" property."
> 
> http://www.robertcailliau.eu/Programming/Revolution/Tutorials/PolygonRotation/zPolygonRotation.html
> 
> the second part of which is plain WRONG; one can set the ANGLE of an 
> irregular polygon, it just doesn't
> have any affect.
> 
> HOWEVER, the Documentation explicitly details  revRotatePoly:
> 
> on mouseUp
>revRotatePoly the long ID of grc "SQUIGGLE", 60
> end mouseUp
> 
> which is a lot simpler than getting misled by Cailliau's stuff about 
> having to use all sorts of complicated
> custom properties.
> 

-- 
View this message in context: 
http://www.nabble.com/Rotating-Polygons-tp25688352p25689152.html
Sent from the Revolution - User mailing list archive at Nabble.com.

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Rotating Polygons

2009-09-30 Thread Mark Wieder
Richmond-

Wednesday, September 30, 2009, 1:24:39 PM, you wrote:

> I popped together a stack containing a Heptagonal regular
> polygon and popped this in a button:

> on mouseUp
>set the Angle of grc "HEPT" to 45
> end mouseUp

> in RunRev 4 that seems to work perfectly well ...

Well, yes, but note that fill patterns and gradients don't rotate with
the graphic, so I would question the definition of "perfectly".

-- 
-Mark Wieder
 mwie...@ahsoftware.net

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Rotating Polygons

2009-09-30 Thread Richmond Mathewson

Mark Wieder wrote:

Well, yes, but note that fill patterns and gradients don't rotate with
the graphic, so I would question the definition of "perfectly".
  

Hey-Ho; I found that one out at the conference and it is a right thorn
in the flesh.

Re: "perfectly"; this is another word that is fairly nebulous.

However revRotatePoly works as well for irregular polygons as
set the angle  does for regular polygons.

As fillGradients and patterns are governed by their own parameters
(rather than being 'part of' the object to which they have been applied)
those have to be juggled to; hence my remarks a few weeks ago about
Ben Beaumont's Rotating Balls . . .

The problem with fillGradient is to keep the relationship between TO,
FROM and VIA intact whilst rotating them with the graphic object.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Rotating Polygons

2009-09-30 Thread Richmond Mathewson

BNig wrote:

Richmond,

you might want to try to put 


on scrollbarddrag scrollbarDragValue
revRotatePoly the long ID of grc "SQUIGGLE", scrollbarDragValue
end scrollbardrag

into a scrollbar and scroll a couple of times from 0 to 360 and back.

Robert is up to a stable rotate

regards
Bernd


  
Presumably what you mean by "a stable rotate" is that the polygon does 
not get distorted

as it rotates.

This:

on mouseUp
  repeat for 360 times
 revRotatePoly the long ID of grc "gXXX", 1
  end repeat
end mouseUp

ends up making the graphic unrecognisable.

I tried this:

on mouseUp
  set the moveSpeed to 65000
  repeat for 360 times
 revRotatePoly the long ID of grc "gXXX", 1
 set the lockScreen to true
 set the width of grc "gXXX" to 300
 set the height of grc "gXXX" to 300
 move grc "gXXX" to 300,300
 set the lockScreen to false
  end repeat
end mouseUp

and the effect is really horrible insofar as the polygon gets badly 
transformed.


Richmond Mathewson-2 wrote:
  

I just have been reading Robert Cailliau's page:


Cailliau claims:

"Unlike images, polygons cannot be directly rotated in Revolution.  They 
have no "angle" property."


http://www.robertcailliau.eu/Programming/Revolution/Tutorials/PolygonRotation/zPolygonRotation.html

the second part of which is plain WRONG; one can set the ANGLE of an 
irregular polygon, it just doesn't

have any affect.

HOWEVER, the Documentation explicitly details  revRotatePoly:

on mouseUp
   revRotatePoly the long ID of grc "SQUIGGLE", 60
end mouseUp

which is a lot simpler than getting misled by Cailliau's stuff about 
having to use all sorts of complicated

custom properties.


It would make things a lot simpler if Cailliau explicitly stated what he 
meant by "rotate".

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Rotating Polygons

2009-09-30 Thread BNig



Richmond Mathewson-2 wrote:
> 
> BNig wrote:
>> Richmond,
>>
>> you might want to try to put 
>>
>> on scrollbarddrag scrollbarDragValue
>> revRotatePoly the long ID of grc "SQUIGGLE", scrollbarDragValue
>> end scrollbardrag
>>
>> into a scrollbar and scroll a couple of times from 0 to 360 and back.
>>
>> Robert is up to a stable rotate
>>
>> regards
>> Bernd
>>
>>
>>   
> Presumably what you mean by "a stable rotate" is that the polygon does 
> not get distorted
> as it rotates.
> 
> This:
> 
> on mouseUp
>repeat for 360 times
>   revRotatePoly the long ID of grc "gXXX", 1
>end repeat
> end mouseUp
> 
> ends up making the graphic unrecognisable.
> 
> I tried this:
> 
> on mouseUp
>set the moveSpeed to 65000
>repeat for 360 times
>   revRotatePoly the long ID of grc "gXXX", 1
>   set the lockScreen to true
>   set the width of grc "gXXX" to 300
>   set the height of grc "gXXX" to 300
>   move grc "gXXX" to 300,300
>   set the lockScreen to false
>end repeat
> end mouseUp
> 
> and the effect is really horrible insofar as the polygon gets badly 
> transformed.
>>
>> Richmond Mathewson-2 wrote:
>>   
>>> I just have been reading Robert Cailliau's page:
>>>
>>>
>>> Cailliau claims:
>>>
>>> "Unlike images, polygons cannot be directly rotated in Revolution.  They 
>>> have no "angle" property."
>>>
>>> http://www.robertcailliau.eu/Programming/Revolution/Tutorials/PolygonRotation/zPolygonRotation.html
>>>
>>> the second part of which is plain WRONG; one can set the ANGLE of an 
>>> irregular polygon, it just doesn't
>>> have any affect.
>>>
>>> HOWEVER, the Documentation explicitly details  revRotatePoly:
>>>
>>> on mouseUp
>>>revRotatePoly the long ID of grc "SQUIGGLE", 60
>>> end mouseUp
>>>
>>> which is a lot simpler than getting misled by Cailliau's stuff about 
>>> having to use all sorts of complicated
>>> custom properties.
>>>
>>> 
> It would make things a lot simpler if Cailliau explicitly stated what he 
> meant by "rotate".
> ___
> use-revolution mailing list
> use-revolution@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Rotating-Polygons-tp25688352p25689904.html
Sent from the Revolution - User mailing list archive at Nabble.com.

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Rotating Polygons

2009-09-30 Thread BNig

Sorry, I hit the send button before writing...

you can make the revRotatePoly somewhat stable by setting a custom property
with the points of the graphic before revRotatePoly. Then whenever you
rotate you start from the original points of the graphic.

like in this

on scrollbarDrag newValue 
lock screen 
set the points of graphic "g1" to the myPoints of graphic "g1" 
revRotatePoly the name of graphic "g1", newValue 
end scrollbarDrag 

regards
Bernd

> on scrollbarddrag scrollbarDragValue
> revRotatePoly the long ID of grc "SQUIGGLE", scrollbarDragValue
> end scrollbardrag


BNig wrote:
> 
> 
> 
> Richmond Mathewson-2 wrote:
>> 
>> BNig wrote:
>>> Richmond,
>>>
>>> you might want to try to put 
>>>
>>> on scrollbarddrag scrollbarDragValue
>>> revRotatePoly the long ID of grc "SQUIGGLE", scrollbarDragValue
>>> end scrollbardrag
>>>
>>> into a scrollbar and scroll a couple of times from 0 to 360 and back.
>>>
>>> Robert is up to a stable rotate
>>>
>>> regards
>>> Bernd
>>>
>>>
>>>   
>> Presumably what you mean by "a stable rotate" is that the polygon does 
>> not get distorted
>> as it rotates.
>> 
>> This:
>> 
>> on mouseUp
>>repeat for 360 times
>>   revRotatePoly the long ID of grc "gXXX", 1
>>end repeat
>> end mouseUp
>> 
>> ends up making the graphic unrecognisable.
>> 
>> I tried this:
>> 
>> on mouseUp
>>set the moveSpeed to 65000
>>repeat for 360 times
>>   revRotatePoly the long ID of grc "gXXX", 1
>>   set the lockScreen to true
>>   set the width of grc "gXXX" to 300
>>   set the height of grc "gXXX" to 300
>>   move grc "gXXX" to 300,300
>>   set the lockScreen to false
>>end repeat
>> end mouseUp
>> 
>> and the effect is really horrible insofar as the polygon gets badly 
>> transformed.
>>>
>>> Richmond Mathewson-2 wrote:
>>>   
>>>> I just have been reading Robert Cailliau's page:
>>>>
>>>>
>>>> Cailliau claims:
>>>>
>>>> "Unlike images, polygons cannot be directly rotated in Revolution. 
>>>> They 
>>>> have no "angle" property."
>>>>
>>>> http://www.robertcailliau.eu/Programming/Revolution/Tutorials/PolygonRotation/zPolygonRotation.html
>>>>
>>>> the second part of which is plain WRONG; one can set the ANGLE of an 
>>>> irregular polygon, it just doesn't
>>>> have any affect.
>>>>
>>>> HOWEVER, the Documentation explicitly details  revRotatePoly:
>>>>
>>>> on mouseUp
>>>>revRotatePoly the long ID of grc "SQUIGGLE", 60
>>>> end mouseUp
>>>>
>>>> which is a lot simpler than getting misled by Cailliau's stuff about 
>>>> having to use all sorts of complicated
>>>> custom properties.
>>>>
>>>> 
>> It would make things a lot simpler if Cailliau explicitly stated what he 
>> meant by "rotate".
>> ___
>> use-revolution mailing list
>> use-revolution@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Rotating-Polygons-tp25688352p25689944.html
Sent from the Revolution - User mailing list archive at Nabble.com.

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Rotating Polygons

2009-09-30 Thread Mark Wieder
Richmond-

Wednesday, September 30, 2009, 2:46:53 PM, you wrote:

> The problem with fillGradient is to keep the relationship between TO,
> FROM and VIA intact whilst rotating them with the graphic object.

I believe you can keep FROM constant, but TO and VIA have to be
interpolated. And the math involved gives me a headache at the moment,
so I'm going out for coffee.

-- 
-Mark Wieder
 mwie...@ahsoftware.net

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution