Author Topic: Getting a second co-ordinate  (Read 2830 times)

0 Members and 1 Guest are viewing this topic.

Offline mike_g

  • Amiga 1200
  • ****
  • Posts: 435
  • Karma: 34
    • View Profile
Getting a second co-ordinate
« on: March 12, 2007 »
Its kind of embarrasing asking such a simple maths question but:

Say I have a start x/y co-ordinate, an angle in degrees, and a distance. How can I get the end x/y co-ordinates from this?

Offline zawran

  • Sponsor
  • Pentium
  • *******
  • Posts: 909
  • Karma: 67
    • View Profile
Re: Getting a second co-ordinate
« Reply #1 on: March 12, 2007 »
If I remember correctly, you can do it something like this:

Code: [Select]
endXpos = startXpos + sin( angle ) * distance
endYpos = startYpos + cos( angle ) * distance

Offline mike_g

  • Amiga 1200
  • ****
  • Posts: 435
  • Karma: 34
    • View Profile
Re: Getting a second co-ordinate
« Reply #2 on: March 12, 2007 »
Thanks man, I'll try that out.

[edit]Yeah works fine :)[/edit]
« Last Edit: March 12, 2007 by mike_g »

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17414
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Getting a second co-ordinate
« Reply #3 on: March 12, 2007 »
Don't be embarrased asking questions, simple or difficult they keep the board alive :) Have some good karma guys.
Shockwave ^ Codigos
Challenge Trophies Won: