Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - mxtra

Pages: [1]
1
German corner / Sphärische in Kartesische Koordinaten umwandeln
« on: October 14, 2013, 06:57:52 pm »
Ich komme irgendwie mit dem Koordinatensystem nicht ganz klar. Ich möchte geografische Koordinaten in die entsprechenden kartesischen Koordinaten umwandeln. Dafür habe ich folgenden Code geschrieben:

   
Code: [Select]
public static SimpleVector geoToCart(double lat, double lon,double R)
{

                lat = lat*0.01745329251;
lon = lon*0.01745329251;

float x = (float) (R * Math.sin(lon) * Math.cos(lat));
float y = (float) (R * Math.sin(lon) * Math.sin(lat));
float z = (float) (R * Math.cos(lon));

SimpleVector ret = new SimpleVector();
ret.x = x;
ret.y = y;
ret.z = z;
return ret;
}

Aufgrund der unterschiedlichen Koordinatensysteme (?) klappt das natürlich nich nicht, aber leider kriege ich das nicht angepasst.

Pages: [1]