Sign in to follow this  
Guest eko

Spherical Geometry

Recommended Posts

I am working on a radar gauge, and I need the spherical geometry to compute:- the distance between my aircraft and another aircraft (both aircraft positions given in latitude/longitude)- the bearing (relative heading) of my aircraft relative to another aircraftThanks for any help !!Eric

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Do you need the full spherical geometry or is a "quasi"-flat geometry sufficient? Since radar distances aren't that great a flat geometry could be precise enough.Arne Bartels

Share this post


Link to post
Share on other sites

double pi=3.1415926535897932384626433832795;double LLdistance(double lat1, double lon1, double lat2, double lon2){ double distance; lat1=lat1*(pi/180); lon1=lon1*(pi/180); lat2=lat2*(pi/180); lon2=lon2*(pi/180); distance = acos(sin(lat1)*sin(lat2)+cos(lat1)*cos(lat2)*cos(lon1-lon2))*((180*60)/pi); return distance;};double LLcourse(double lat1, double lon1, double lat2, double lon2){ double course; lat1=lat1*(pi/180); lon1=lon1*(pi/180); lat2=lat2*(pi/180); lon2=lon2*(pi/180); course = fmod(atan2(sin(lon1-lon2)*cos(lat2),cos(lat1)*sin(lat2)-sin(lat1)*cos(lat2)*cos(lon1-lon2)), 2*pi); return course;};Chris Filehttp://www.avsim.com/pss/phoenix.jpg

Share this post


Link to post
Share on other sites

Thanks for your help !!Your formulas helped me much. My radar gauge is almost finished, it works pretty fine now.Eric

Share this post


Link to post
Share on other sites

A little more patience, I'll release it soon. To make you wait, here are some screenshots. They show the 3 radar modes: global, horizontal and vertical.Eric

Share this post


Link to post
Share on other sites

Chris, Thank you.... Been looking all over for this info.Roman(KGRB)

Share this post


Link to post
Share on other sites

Just to let you know tables are much faster (cept I dont know how to use them !) and wondering if fsim uses tables in trig calculations?mr gray

Share this post


Link to post
Share on other sites

My radar and HUD gauges have finally been released. I included them on Johan Peeters' F-16 panel.Due to problems with Rick Rossner, AVSIM will never see again a single piece of my work. You can get the panel on the other site. Search the file f16pnlem.zip.Enjoy !!!Eric

Share this post


Link to post
Share on other sites

Oh yeah, I really must admit, this is great. You did a good piece of work. It doesn't just work, it also looks good (animations etc.)! :-) How the hell did you get the different mouse hot spots moving around... Incredible.Just keep up the great work, would like to see other gauges of this quality! :-hahRegards :-wave from EDDFhttp://flightsimmers.net/airport/etti/signature_pro.jpgPS. Hmmm since FlightSim.Com is down again (as always... :-erks) and since I don't get any acceptable result out of the AVSIM File Library, I don't have a F-16 a/c yet... Tried the panel only with the Learjet.

Share this post


Link to post
Share on other sites

Thanks for your compliments !!You can get the excellent F-16 by G.Chiacchietta on FS Freeware.One link is: FRF_F-16_C.zipHave fun !!

Share this post


Link to post
Share on other sites

Hey I just woke up, got to the PC, fired up FS and tried it once more, with 100% ATC, and it's just cool!!! Escorted a Dash 8 in my, errr... still - Learjet. But thank you for the link, I gotta download that F-16 now. But tell me one thing: Well I've seen it on other fighter panels, but what's that indication?http://flightsimmers.net/airport/etti/avsi...hers/escort.jpg> Have fun !!I DO!!!Thanks again! :-hahRegards :-wave from EDDFhttp://flightsimmers.net/airport/etti/signature_pro.jpg

Share this post


Link to post
Share on other sites

This indicates if you're flying straight, climbing or descending. It is redudant with the 2 little arrows that appear on the HUD above or below the altitude numerical display.It is a sort of vertical speed display which only indicates if it is positive, negative or null.Eric

Share this post


Link to post
Share on other sites

Eric, the RADAR gauge is just BRILLIANT! The HUD is super as well, nice to finally have a decent one I can add to fighters, but the RADAR gauge just totally stole the show. And I love the way the details show up on the HUD too. I am VERY impressed. I loved your AIRBUS gauges and this is just another fine piece of work. Truly excellent.Would it be possible to extend the range of the RADAR to, like, say, 80miles? Or is this something that would involve a lot of re-coding? Or is it even feasible?

Share this post


Link to post
Share on other sites

Well, I decided to make this gauge a little more stand-alone, so I could add it to any panel I want. I am using Buddy K. Guy's RKG buttons so I can call it up as a "MINI_CONTROLS_PANEL" window wherever I want... that won't ever conflict with anything. :)This allows me to place a button on the main panel to call the window, and then I have a transparent button on the window bitmap which closes the radar window. (The X on the left bottom button.)I added the mode and zoom buttons to it, so it is basically a "stand-alone" radar unit. I am not at all that happy with the quality of the bitmap I needed to use, so if anybody has a better, similar bitmap which I could work with Photoshop, I'd appreciate it if you could e-mail me a copy. (jspx@mac.com)Eric, you could release this as a stand-alone add-on with the right good looking bitmap. I could package it and write some installation instructions. :)Here is a shot of it installed in my A-10.http://www.lovett.org/jsp/pub/fs/radar.jpg

Share this post


Link to post
Share on other sites

I use VC++ 5.0.I'm sorry that it doesn't work for you. C programming is not that easy. I did this for years for my work, so it is relatively easy for me (it is my job...), but I understand that it is complex for someone who discovers it. VB is much easier, but unfortunately you can not develop gauges with VB.Did you try XML gauges?Eric

Share this post


Link to post
Share on other sites

Thanks for your compliments !!Today, it is not possible to extend the radar range over 40 NM, because it is based on the information provided by FSUIPC. For performance reason, it is limited to 40 NM, and only Pete Dowson can change this. In my opinion, 40 NM is enough, and it is quite realistic compared to the performance of real aircraft radars.EricVisit my web site

Share this post


Link to post
Share on other sites

I like the concept of having the radar in a separate window. It helps in integrating the radar in panels where there is no room to put the radar.I think the window graphics are OK. If you want to release the modified panel, or just the additional panel window, I'd just like to see it before giving you my authorization to release. If you prefer, you can send me what you did (including the documentation) and I'll publish it for you. As you wish...EricVisit my web site

Share this post


Link to post
Share on other sites

Yup dude, I tried both XML and C gauges (BCC55 compiling). I think it may get easy if you once get the hang of it. But that might be the most difficult part (at least for a beginner), to get the hang of it...Well the FS crashes, maybe it has to do with Win XP, I know there are some problems which have also been discussed in the Aircraft and Panel Design Forum.But damn it, I won't give up, until I have my (really MY, not a tutrial) first working gauge ready to fly.Hehe it's gonna take some time til I make some of the complexity of yours... :-hah You're doing very well.Keep it up man!Kind Regards :-wavehttp://flightsimmers.net/airport/etti/signature_pro.jpg

Share this post


Link to post
Share on other sites

What I think I'm going to do... is write some instructions/tutorial on how to add windows and toggle buttons using one or two of the default aircraft as examples. I'll probably use the King Air, Mooney, and Baron. With that information in hand, the end-user should be able to figure out how to add it to any panel they so wish.I'll keep in touch Eric, and I'll update you as to my progress in writing this thing out. Also, no problem with the RADAR range, I was just curious if it could be extended or not.

Share this post


Link to post
Share on other sites

>until I have my (really MY, >not a tutrial) first working gauge ready to fly. Well, I do now! It went faster than I thought!There were as usual some XP problems, frozen progress bars in FS, program crashes, computer reset knob hittings *:-* but the result is there, yeah. :-beerchug:9 Way to go!http://flightsimmers.net/airport/etti/signature_pro.jpg:-newbie

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