1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Greetings Guest!!

    In order to combat SPAM on the forums, all users are required to have a minimum of 2 posts before they can submit links in any post or thread.

    Dismiss Notice

Anyone know Trig?

Discussion in 'Off Topic' started by Elric_Soban, Oct 25, 2011.

  1. Elric_Soban

    Elric_Soban Babbling Loonie
    Stratics Veteran Stratics Legend

    Joined:
    Dec 7, 2004
    Messages:
    2,258
    Likes Received:
    14
    I have an X,Y Coordinate, an angle, and a distance.
    If i start at point X, Y, travel along the angle for the given distance, I should be able to calculate the resulting new X,Y.

    ive been scouring the net for the formula, with no luck. so far i have

    X2 = X + (distance * Cos(angle))
    Y2 = Y + (distance * Sin(angle))

    but it doesn't appear to be working.
    Any help? Thanks!

    Ok I have determined that infact:


    X2 = cos(angle) * distance
    Y2 = sin(angle) * distance

    What if i have a starting point other than 0,0? How does that new co-ord fit in?
     
  2. Loren

    Loren Journeyman
    Stratics Veteran

    Joined:
    Aug 5, 2011
    Messages:
    299
    Likes Received:
    90
    Assuming (carefull with that),
    We are talking about angle with respect to the positive X-axis, then this will be eazy peazy lemon squeezy.

    What the angle is referenced from is much more important than the starting point, imho.

    You will not need a formula per se, just recall the relationship between x,y,r, and theta.
    change in X = r*cos(theta), change in y = r*sin(theta)
    r = distance traveled.

    So, plug in your distance as r, and solve. Add or subtract as appropriate with the coordinate pair that is your origin.
     
  3. Taylor

    Taylor Former Stratics CEO (2011-2014)
    Professional VIP Stratics Veteran Supporter Alumni Campaign Benefactor Alumni

    Joined:
    Oct 21, 2008
    Messages:
    8,023
    Likes Received:
    1,714
    I can almost balance a checkbook.