February 13, 200422 yr Commercial Member 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 Jon Blum Vertical Reality Simulations
February 13, 200422 yr 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
February 13, 200422 yr Author Commercial Member >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 Jon Blum Vertical Reality Simulations
February 13, 200422 yr 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" Jan "Beatus ille qui procul negotiis..."
February 13, 200422 yr 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" Jan "Beatus ille qui procul negotiis..."
February 14, 200422 yr Author Commercial Member 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. Jon Blum Vertical Reality Simulations
Create an account or sign in to comment