Jump to content
Sign in to follow this  
Varmint007

Trying to plot a navaid in an HSI

Recommended Posts

I've been messing around with the following code, with really bad results, and I was wondering if anyone might know what I'm doing wrong.I'm trying to plot the location of a VOR in my HSI given bearing and distance. It's plotting the distance correctly, but the x,y coordinates are just spiraling around the central axis.Since works with signed coordinates along each axis, I assume using cartesian won't work without some modification, which is why I reversed the sign of the distance for the Y axis.BTW, I'm trying to plot from an axis at the center of the gauge and display the vor relative to that. Any help would be greatly appreciated, as I've tried every variation I can think of, and my third grade math has taken me about as far as I can go:) (A:NAV1 DME, nmiles) (A:NAV1 RADIAL, degrees) dnor sin * (A:NAV1 DME, nmiles) /-/ (A:NAV1 RADIAL, degrees) dnor cos * --Jon

Share this post


Link to post
Share on other sites
Guest bartels

Do you need radians instead of degree for the trigonometric functions? degrd or rddeg or how it is called after the dnor, it is in the SDK somewhere.Arne Bartels

Share this post


Link to post
Share on other sites

>Do you need radians instead of degree for the trigonometric>functions? degrd or rddeg or how it is called after the dnor,>it is in the SDK somewhere.>Arne BartelsI did try using radians, but the outcome was similarly wierd. It could be that the sin/cos functions are broken, but it's more likely my code sucks and I'm doing it wrong:) I've never seen them used in an XML gauge, so I don't know.I suppose I could also try using polar coodinates and atg2, but it could be messy.Anybody want to test this one out?--Jon

Share this post


Link to post
Share on other sites

Hi,Just an idea:Assume the VOR is located on x and y coordinates.This point is determined by the DME arc, distance, and the radial to or from the VOR.The distance relative to the heading is a sinus function of DME and radial: x=asin(a) a=DME; (a)=difference between heading and radial.So with constant heading you can use the funcion "pixelspersecond" to let the point, pic, move along a linedetermined by the altering DME and Radial.Changing course does alter both parameters but still the shift function must work.It becomes more complicated when there is no dme, but then you can use the known coordinates of the point and the actual position of the plane using the great circle calculations.I will try to effect that myself if i have time.Interesting to make a moving map that way.Jan"Procul Negotiis"

Share this post


Link to post
Share on other sites

Hi,1. Some succes.2. Headache.Tested it for a piece of earth of 5 nm sq.May be someone could make it more useful.(A:NAV1 DME,nmiles) (>L:DME,nmiles)(A:NAV1 Radial,radians) (A:Plane heading degrees gyro,radians) - pi 2 / + (>L:rad,radians)(L:rad,radians) sin (L:DME,nmiles) *(L:rad,radians) cos (L:DME,nmiles) *Jan"Procul Negotiis"

Share this post


Link to post
Share on other sites

Jan,That works brilliantly! Now I can use that to plot Navaids of all sorts, and I can even run a courseline through it and rotate the courseline with the course select to display interceptions.I would assume all one would need to do to change the scale is replace the value in with a scale variable and you'd have a real useful little display.Great circle navigation to/from is another matter:)I still can't understand why the distance * sin(angle) and -distance * cos(angle) formula wasn't working, even though Arne was right about needing radians. /shrug.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...