static public Vector3d SterographicTo3d(double x, double y, double radius, double standardLat, double meridean, double falseEasting, double falseNorthing, double scale, bool north) { double lat = 90; double lng = 0; x -= falseEasting; y -= falseNorthing; if (x != 0 || y != 0) { double re = (1 + Math.Sin(Math.Abs(standardLat) / 180 * Math.PI)) * EarthRadius / scale; double rere = re * re; double c1 = 180 / Math.PI; if (x == 0) { lng = 90 * y < 0 ? -1 : 1; } else { lng = Math.Atan2(y, x) * c1; } //if (x < 0) //{ // lng = lng + (180 * Math.Sign(y)); //} //if (lng > 180) //{ // lng -= 360; //} //if (lng < -180) //{ // lng += 360; //} double len = (x * x) + (y * y); lat = (rere - len) / (rere + len); lat = Math.Asin(lat) * c1; if (!north) { lat = -lat; lng = -lng; meridean = -meridean; } } return(Coordinates.GeoTo3dRad(lat, 90 + lng + meridean, radius)); }
public void Prepare() { worldList = new Vector3d[table.Count]; transformedList = new Vector3d[table.Count]; int index = 0; foreach (string[] row in table) { DataItem item = new DataItem(); item.EventTime = Date.Parse(row[DateColumn]); double radius = (earthRadius - double.Parse(row[depthColumn]) * 1000) / earthRadius; item.Location = Coordinates.GeoTo3dRad(double.Parse(row[latColumn]), double.Parse(row[lngColumn]) + 180, radius); item.Tranformed = new Vector3d(); item.Size = (float)Math.Pow(2, double.Parse(row[magColumn])) / 50; worldList[index] = item.Location; transformedList[index] = item.Tranformed; items.Add(item); index++; } }