Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Vector Calculation

  1. Mar 2, 2008 #1
    1. The problem statement, all variables and given/known data
    Im not sure where exactly i should post this, but im going to assume its here. basicaly what i am working on is programming a GPS tracking system inside a game. i have two GPS coordinates, one of the object that will be moving towards a stationary gps, and a stationary "target" GPS. ive figured out that it will be two points on a plane, what i need is the equation to find Dv or the direction to the Target GPS from the object GPS relative to the direction the object is facing . ive drawn a picture to assist myself in finding out exactly what i need to do.
    Pr=Gps on object, the line that contains Pr represents the direction that the object is facing, Pt=Target Gps, Dv=Directional Vector, Theta = Angle to Pt, Ignore Dv+ and Dv- i simply put that there to say that one side of Pr will be negative and the other positive along Dv. what i need to know is how to get the value of Dv with an equation. The Large circle around Pr represents its rotational possibilities. Note Dv must always be perpendicular to the Line Pr is in (which represents the object)

    2. The attempt at a solution
    I think ive figured out how to get Theta, but i could be wrong:
    X = Xr - Xt
    Y = Yr - Yt
    Theta = atan(Y,X)-Yaw

    Yr and Yt being the Y values of Pr And Pt Respectively
    Xr and Xt being the Y values of Pr And Pt Respectively
    Yaw being the direction the object is facing relative to the world within -180 to 180 Degrees

    Any help would be appreciated, i hope i explained everything alright, if not, just ask, ill elaborate.
    Last edited: Mar 2, 2008
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?