# 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 on other sites
 Help AVSIM continue to serve you!Please donate today!

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 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 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 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.

## Create an account

Register a new account

• Tom Allensworth,
Founder of AVSIM Online

• ### Hot Spots

• 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!

• ### Donation Goals

AVSIM's 2018 Fundraising Goal

Donate to our annual general fund. This donation keeps our doors open and providing you service 24 x 7 x 365. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. We reset this goal every new year for the following year's goal.

\$17,895.00 of \$36,000.00 goal reached.
Donate Now