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

Perhaps this is trig?

  1. Oct 9, 2006 #1
    im trying to write a program to determine target motion analysis, the problem im having is determining how to get my computer to understand what side the 2 objects are on. heres an example. say im a boat heading 300, so a little north west, and i have a contact on my right side, i need my program to be able to determine that its on my right side, so his possible bearings are 301degrees past 0 though 120 degrees which would be all on my right side. how can i write this to be solved ? with a simple if statement the numbers get skewed because my number set is restart again at 0 (301-359, 0-120). and the kicker of it is i need to be able to solve this problem when my heading is possilby 0-360 degrees.....

    thanks

    i know i can explain this better but im having problems understanding how to approach it myself
     
    Last edited: Oct 9, 2006
  2. jcsd
  3. Oct 9, 2006 #2

    SGT

    User Avatar

    Relative_bearing = Bearing - Heading;
    if Relative_bearing < 0 then Relative_bearing = relative_bearing + 360;
    if Relative_bearing < 180 then side = right; else side = left;
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Perhaps this is trig?
  1. Game theory perhaps? (Replies: 3)

  2. Trig Identities (Replies: 3)

  3. Trig books (Replies: 2)

  4. Trig in 3D (Replies: 1)

Loading...