The simFlight Network Forums

# Longitude/Latitude Helper Classes, Feature Request

## Recommended Posts

Hallo Paul,

currently I'm working on a program which generates map overlays for flight path, filed flight plan, approach and depature procedures. I use your fsuipc.dll for all the coordinates calculation. Works great :-), thanks.

In order to complete my program I would need some additional coordinate calculations as part of your Longitude/Latitude Helper Classes:

1. Calculation of a Lat / Lon given by the following descripition (example): Track yyyy (degree) from XXXX (Lat / Lon) until intercepting radial ZZZ (degree) from a given coordinate (Lat / Lon)

2. Calculation of a Lat / Lon given by the following descripition (example): Track yyyy (degree) from XXXX (Lat / Lon) until a certain distance (DME) to a given coordinate (Lat / Lon)

Would be great if version 3.0 of your fsuipc.dll would have these additional features.

Regards,

Ruediger

##### Share on other sites

Hi Ruediger,

Good suggestions. I'll have a look at this in the next few days,

Paul

##### Share on other sites

Perfect, thanks....

Ruediger

##### Share on other sites

Hi Paul,

I have already code to do this. Tell me if you want it.

Motus

##### Share on other sites

Hi Motus,

I got most of this done last night, but thanks for the offer.

Paul

##### Share on other sites

Hi Ruediger,

Ready for testing. New DLL attached. Just overwrite your current DLL and XML files.

The new methods added to FsLatLonPoint are:

Calculates the intersection from the current point along the Bearing to where it meets the Radial from the other Point.

Check the IsValid property of the point returned to make sure it's valid. Invalid points are generated if the bearing and radial never intersect, or if the intersection is more than 200NM from the Point. This is an arbitrary limit but some limit must be placed or else some results could be hundred of thousands of miles away from the Point which doesn't make sense. I could increase the limit if required.

Sample code:

```            FsLatLonPoint myPlaneLocation = new FsLatLonPoint();
FsLatLonPoint vorLocation = new FsLatLonPoint();
double myBearing = 40;

// find where the plane (flying bearing 040) will intersect radial 180 of the VOR:
if (intersection.IsValid)
{
// Do stuff with intersection
}
else
{
// No intersection possible, or intersection is more than 200NM from VOR
}
```

FsLatLonPoint IntersectDMENauticalMiles(double Bearing, FsLatLonPoint Point, Double Distance)
FsLatLonPoint IntersectDMEMetres(double Bearing, FsLatLonPoint Point, Double Distance)
FsLatLonPoint IntersectDMEFeet(double Bearing, FsLatLonPoint Point, Double Distance)

Calculates the intersection from the current point along the Bearing to where it is the specified Distance from the other Point.

Check the IsValid property of the point returned to make sure it's valid. Invalid points are generated if the bearing never goes within the specified distance of the point.

Sample code: (using the method for Metres)

```            // find where the plane (flying bearing 040) will be 1km from the VOR:
FsLatLonPoint intersection2 = myPlaneLocation.IntersectDMEMetres(myBearing, vorLocation, 1000);
if (intersection2.IsValid)
{
// Do stuff with intersection
}
else
{
// No intersection possible. The bearing never comes within 1km of the VOR
}

```

Paul

FSUIPCClient3.0_BETA.zip

##### Share on other sites

Hi Paul,

how did you do that so fast? :-)

Many, many thanks......

I will test it and give you a response by tomorrow afternoon.

Ruediger

##### Share on other sites

Hi Paul,

today I had less spare time than expected. I could only test IntersectDMENauticalMiles. Works perfect. That exactly what I need.

Tomorrow I will be out of town. The final test I will  perform on Thursday.

Rüdiger

##### Share on other sites

Hi Paul,

so far all my test cases worked very well. Starting now with the implementation. If I find an issue I will inform you.

Thanks again...

Ruediger

Good to hear,

Thanks,

Paul

## Create an account

Register a new account