public locWGS84 Pos2Loc(Vector3 wayPoint) { double lat = ((360 / Mathf.PI) * Mathf.Atan(Mathf.Exp(0.00001567855943f * (wayPoint.z + initZ)))) - 90; double lon = (18000 * (wayPoint.x + initX)) / 20037508.34f; locWGS84 result = new locWGS84 (lat,lon); return result; }
public locWGS84 Pos2Loc(Vector3 wayPoint) { double lat = ((360 / Mathf.PI) * Mathf.Atan(Mathf.Exp(0.00001567855943f * (wayPoint.z + initZ)))) - 90; double lon = (18000 * (wayPoint.x + initX)) / 20037508.34f; locWGS84 result = new locWGS84(lat, lon); return(result); }
public locWGS84 Pos2Loc(Vector3 wayPoint) { double lon = ((wayPoint.x + initX) / 20037508.34) * 180 * gps.mapScale; double lat = ((wayPoint.z + initZ) / 20037508.34) * 180 * gps.mapScale; lat = 180 / Math.PI * (2 * Math.Atan(Math.Exp(lat * Math.PI / 180)) - Math.PI / 2); locWGS84 result = new locWGS84(lat, lon); return(result); }
public double GeoDistance(locWGS84 loc1, locWGS84 loc2) { double radius = 6371; double dLat = this.toRadian(loc2.Latitude - loc1.Latitude); double dLon = this.toRadian(loc2.Longitude - loc1.Longitude); double a = Math.Sin(dLat / 2) * Math.Sin(dLat / 2) + Math.Cos(this.toRadian(loc1.Latitude)) * Math.Cos(this.toRadian(loc2.Latitude)) * Math.Sin(dLon / 2) * Math.Sin(dLon / 2); double c = 2 * Math.Asin(Math.Min(1, Math.Sqrt(a))); double d = radius * c; return d; }
public double GeoDistance(locWGS84 loc1, locWGS84 loc2) { double radius = 6371; double dLat = this.toRadian(loc2.Latitude - loc1.Latitude); double dLon = this.toRadian(loc2.Longitude - loc1.Longitude); double a = Math.Sin(dLat / 2) * Math.Sin(dLat / 2) + Math.Cos(this.toRadian(loc1.Latitude)) * Math.Cos(this.toRadian(loc2.Latitude)) * Math.Sin(dLon / 2) * Math.Sin(dLon / 2); double c = 2 * Math.Asin(Math.Min(1, Math.Sqrt(a))); double d = radius * c; return(d); }