Jump to content
The simFlight Network Forums

Craig Phillips

Members
  • Posts

    13
  • Joined

  • Last visited

Posts posted by Craig Phillips

  1. I did notice a problem that I had with retreiving the traffic data, however that is now resolved.

    Here is a snipbit of the code, it is in Visual Basic, but it should be easy enough to understand:

    gcbearing = the bearing from current plane to one of the traffic

    nmm = is the distance between the two planes in Nautical Miles

    The Mod function cancels a number down, for example:

    369 Mod 360 = 9

    180 Mod 90 = 90

    181 Mod 90 = 1

    (180 / (4 * Atn(1))) = is the radians

    127.5 = is the ratio to draw on the radar

    po = gcbearing Mod 90
    po = gcbearing / (180 / (4 * Atn(1)))
    
    'Find the height
    hi = (Sin(po) * nmm) * 127.3125 
    
    'Find the length
    lo = (Cos(po) * nmm) * 127.3125
    
    
    'Plot the planes on the radar screen
    If gcbearing > 0 And gcbearing < 90 Then
    plane1(i).Top = (plane1(0).Top + hi + (plane1(i).Height / 2)) * 1
    plane1(i).Left = (plane1(0).Left + lo + (plane1(i).Width / 2)) * 1
    ElseIf gcbearing > 90 And gcbearing < 180 Then
    plane1(i).Top = (plane1(0).Top + hi + (plane1(i).Height / 2)) * 1
    plane1(i).Left = (plane1(0).Left + lo + (plane1(i).Width / 2)) * 1
    ElseIf gcbearing > 180 And gcbearing < 270 Then
    plane1(i).Top = (plane1(0).Top + hi + (plane1(i).Height / 2)) * 1
    plane1(i).Left = (plane1(0).Left + lo + (plane1(i).Width / 2)) * 1
    ElseIf gcbearing > 270 And gcbearing < 360 Then
    plane1(i).Top = (plane1(0).Top + hi - (plane1(i).Height / 2)) * 1
    plane1(i).Left = (plane1(0).Left + lo - (plane1(i).Width / 2)) * 1
    End If
    

    I hope this is understandable.

    Thanks

    Craig

  2. I have already used the functions to find out each X and Y, however it does not seem to work.Are the X and Y formulas the same for each quadrant? For example: Bearing > 0 and <90

    b=Bearing

    nm = Distance (nm)

    x=Cos(b / (180/PI)) * nm

    y=Sin(b/ (180/PI)) * nm

    I am stuck on finding the x and y lengths. What are the other X and Y formulas for each quadrant?

    Thanks

    Craig

  3. Pete

    I am making a Traffic radar program just like TrafficLook, however my radar screen is "plane is north". If you get what I mean. I have been using the Aviation Formulary at http://williams.best.vwh.net/avform.htm.

    I can work out the distance and the bearing from the current aircraft to the AI traffic, however I am unable to present it on the Radar screen. I have also been using trigonometry, however I am not familiar with it.

    I was wondering if you could show me an example of how you present the traffic in TrafficLook. It would be much appriated. Thanks

    CRaig

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.