Author Topic: math formula..i suck at math..please help :(  (Read 2730 times)

0 Members and 1 Guest are viewing this topic.

Offline .:] Druid [:.

  • freebasic n00b
  • Pentium
  • *****
  • Posts: 563
  • Karma: 47
    • View Profile
    • Intro-Inferno
Hi guys....sorry to bother with a new thread but i really suck at math and i'm tired of searching...this will be pretty simple for most of you:
what is the rotation formula?  if i draw a square or a triangle, how can i rotate it???  thanks in advance for your help
[sheep]: im sure he wants to goto prison.. they didnt get him last time.. he was promised a big cock up his arse.. and no doubt looking forward to it.. lets hope he gets his wish this year.

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: math formula..i suck at math..please help :(
« Reply #1 on: July 27, 2007 »
Around one axis is easy;

Code: [Select]
theta = angle

xold =  x
yold = y

xnew = cos(theta)*xold - sin(theta)*yold
ynew = sin(theta)*xold + cos(theta)*yold

x=xnew
y=ynew

Hope that helps.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline .:] Druid [:.

  • freebasic n00b
  • Pentium
  • *****
  • Posts: 563
  • Karma: 47
    • View Profile
    • Intro-Inferno
Re: math formula..i suck at math..please help :(
« Reply #2 on: July 27, 2007 »
wow..that's fast!  i'm gonna try tonight and give you the feedback!  you're my hero..as usual :)
[sheep]: im sure he wants to goto prison.. they didnt get him last time.. he was promised a big cock up his arse.. and no doubt looking forward to it.. lets hope he gets his wish this year.

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: math formula..i suck at math..please help :(
« Reply #3 on: July 27, 2007 »
No worries :)

I just remembered that Emil asked a similar thing (but for rectangles) and I wrote some example code in freebasic, it is here;

http://dbfinteractive.com/index.php?topic=2134.0

So that should get it working for you mate.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline .:] Druid [:.

  • freebasic n00b
  • Pentium
  • *****
  • Posts: 563
  • Karma: 47
    • View Profile
    • Intro-Inferno
Re: math formula..i suck at math..please help :(
« Reply #4 on: July 27, 2007 »
thanks again!  my bad, i thought i looked over and over on this forum and did not find it...too stoned maybe :s
[sheep]: im sure he wants to goto prison.. they didnt get him last time.. he was promised a big cock up his arse.. and no doubt looking forward to it.. lets hope he gets his wish this year.