Page 1 of 1

Rotating an Oval

Posted: Sat Jul 29, 2006 8:29 pm
by paulgr
Hi All,
I do appear to have one sticking point with Rev -- it's inability (or maybe my inability to get it to work) to rotate a vector that contains a smooth curved edge -- like an Oval.
I have an Object (Oval vector) following a randomly generated bezier path -- I want the vector to turn and point along the path as it goes along the path.
No problem with the path and moving the object along it, but rotating/turning as it goes seems impossible.

I have read all the documentation and noted the differences between angle, rotation and revRotatePoly.
Docs say use the revRotatePoly command to rotate a line, curve, or irregular polygon graphic, and use angle to set the angle of a regular polygon or image.
Doesn't seem to leave much to rotate an oval with.

I have come to the conclusion (possibly wrong) that it is impossible to rotate a vector oval, using either revrotatepoly or the angle function.
I have read through the many rotation/angle references in the user group, and I did gain some useful insight through the opinions of Jim Hurley, Malte and a few others that have commented on this subject.

The inability of being able to rotate a smooth curved vector is a major disincentive to me using Rev, as many games require this.

I can rotate an image of course, but then you lose the hard smooth edge that vectors give.

If anyone can show me the way through this problem, what I am doing wrong, or has a workaround, I would appreciate it. I can't believe a simple thing like rotating a vector containing a smooth curve is so difficult.

cheers
Paul

Posted: Sat Jul 29, 2006 10:19 pm
by malte
Hi paul,

It is not possible to rotate an oval in rev. This is just speaking of the built in oval object. If you calculate the points of the oval beforehand and use an irregular poly to display it, you can rotate that. For most purposes that should do the trick, howeverr it would be nice to have it as a built in property.

All the best,

Malte

Posted: Sat Jul 29, 2006 11:04 pm
by Benedikt.Seidl
i like those little mathematic problems, so i wrote a function for you:

Code: Select all

function ro_el twidth, theight, tlocx, tlocy, tangle
  repeat with i = 0  to 360
    put (sin((i)/180*pi)*(twidth))  into x
    put (cos((i)/180*pi)*(theight)) into y
    put   round(x * cos(tangle/180*pi) + y * sin(tangle/180*pi) + tlocx) & comma & \
          round(y * cos(tangle/180*pi) - x * sin(tangle/180*pi) + tlocy) & cr after tpoints
  end repeat
return tpoints
end ro_el
go stack URL "http://swine.de/daten/oval.rev" <- the function in action


SEIDL.

Posted: Sun Jul 30, 2006 1:59 am
by paulgr
Thanks Malte for confirming my thoughts -- I guess I've just have to work in straight lines from now on.

Thanks for your code, SEIDL.
I have tried building an oval with code in a similar way to your suggestion already, but can't get the smooth curve I'm after this way, at least on XP.

I'll just use other shapes in more inventive ways :-)

cheers
Paul

Posted: Sun Jul 30, 2006 12:44 pm
by DarScott
malte wrote:It is not possible to rotate an oval in rev. This is just speaking of the built in oval object.
It is unfortunate that 'angle' is the same as 'startAngle' for ovals. That meaning is unlike the meaning for other controls. I would not mind if that changes to a meaning like the others. The change would break some scripts, though. It would be cool (if done well) to have an angle for groups, which would make the lack of real angle for oval less of a problem.