Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Cos Sin and Circles

Author
Message
Old Wrinkly
21
Years of Service
User Offline
Joined: 14th Dec 2002
Location: Nth Devon UK
Posted: 17th Mar 2004 11:16
Ive forgoten how to create ovals and circles using Cos and Sin.
I sometimes used this to control sprites.
Can someone remind me please. Old Wrinkly
Gu re gu
21
Years of Service
User Offline
Joined: 14th Dec 2002
Location: United Kingdom
Posted: 17th Mar 2004 11:31
You talking about moving something in a circle or drawing a circle?
Anyway sin and cos work like this - sin(angle)*distance

So if you want to find the component XY coordinates:
x#=cos(angle)*dist#
y#=sin(angle)*dist#

You may need to swap the sin and cos around to get it to work correctly, it depends on how you're using it. Just make sure you don't have both sin or both cos, 'cause that'll just slide diagonally back and forth.

If you want ovals, just play about with the dist# variable.

Just incase you don't know - sin(0)=0 ... cos(0)=1 ... sin(90)=1 ... cos(90)=0

Daih thel phae 'e, clann 'e phaen
Blame it on INSANITY!
Old Wrinkly
21
Years of Service
User Offline
Joined: 14th Dec 2002
Location: Nth Devon UK
Posted: 18th Mar 2004 22:06
Problem has now been overcome from a posting in code snipits.OldWrinkly

Login to post a reply

Server time is: 2024-09-22 02:46:50
Your offset time is: 2024-09-22 02:46:50