Beispiel #1
0
 //
 // Calculate direction and distance between two GPS Positions,
 // expressed as a vector in meters.
 //
 // That is, the returned vector represent direction and distance
 // that you need to travel from this position to reach toPos position.
 //
 public Vector3 GetVector(GPSPosition toPos)
 {
     toPos = ToSameProjection(toPos);
     return(new Vector3(
                (float)(toPos.East - East),
                (float)(toPos.Altitude - Altitude),
                (float)(toPos.North - North)));
 }
Beispiel #2
0
        //
        // If specified position is in different projection, convert the
        // position to our projection.
        //
        GPSPosition ToSameProjection(GPSPosition pos)
        {
            if (string.Compare(Projection, pos.Projection, true) == 0)
            {
                /* already same projection, no conversation required */
                return(pos);
            }

            /* convert position to WGS84 and then to our sweref projection */
            double longitude, latitude, elevation;

            GeodesyTransforms.toWGS84(pos, out longitude, out latitude, out elevation);

            return(GeodesyTransforms.fromWGS84(Projection, longitude, latitude, elevation));
        }