help! stos sin and cos commands with simple polygon

STOS-related stuff in here please

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

rat tisa
Atari User
Atari User
Posts: 40
Joined: Mon Oct 11, 2004 8:42 pm

help! stos sin and cos commands with simple polygon

Postby rat tisa » Thu Nov 25, 2004 10:55 pm

I'm trying to rotate a simple polygon using some info from ST format.

It says that if you have a center point and draw a polygon from that with coords like 0,100 to -75,100 to -75,0 and then multiply the x coords by sin(value of degrees) and y by cos(value of degrees) and then add them to the existing coords it will rotate your polygon.

I have tried many different ways now but cannot get this to work the way it is meant, PLEASE HELP!

User avatar
tobe
Atari God
Atari God
Posts: 1459
Joined: Sat Jan 24, 2004 10:06 am
Location: Lyon, France
Contact:

Postby tobe » Thu Nov 25, 2004 11:26 pm

I don't have any knowledge in STOS, but you can try cos(deg*PI/180) and sin(deg*PI/180).
Build two tables with the values of sin[0-359] and cos[0-359], it will run faster.
step 1: introduce bug, step 2: fix bug, step 3: goto step 1.

insanity
Captain Atari
Captain Atari
Posts: 173
Joined: Wed Oct 15, 2003 12:31 pm
Location: Leicester, England

Postby insanity » Thu Nov 25, 2004 11:27 pm

Ok... just used google to find this page:

http://www.geocities.com/SiliconValley/2151/math2d.html

Part way down it has this:


2D Rotation

A point <x,y> can be rotated around the origin <0,0> by running it through the following equations to get the new point <x',y'> :

x' = cos(theta)*x - sin(theta)*y
y' = sin(theta)*x + cos(theta)*y



Any help?

baz

rat tisa
Atari User
Atari User
Posts: 40
Joined: Mon Oct 11, 2004 8:42 pm

Postby rat tisa » Thu Nov 25, 2004 11:33 pm

I'll definately give that a go, It looks like it would be the right equation.

STf's just keeps adding and doesn't actually rotate.


Social Media

     

Return to “STOS”

Who is online

Users browsing this forum: No registered users and 3 guests