Hi Karsten, et al...
I'm still a little lost. Haven't invested the time into setting up a project in Eclipse yet, but I did browse the source, and it does make sense, in a more concise way than the code I had taken from Jer.
That being said, I took the computePosOnSphere() function from your source, and it's giving me very different results (which... is expected, seeing as how it is a different function...

)
- public Vec3D computePosOnSphere(int globeRadius) {
- // build a spherical position from lat/lon and convert into XYZ space
- pos = new Vec3D(globeRadius, MathUtils.radians(currentLongitude) + MathUtils.PI,
- MathUtils.radians(currentLatitude)).toCartesian();
- return pos;
- }
(which returns {x:-118.39131, y:158.68607, z:-28.32369} ) draws the Green line,
and the old code, which I took from Jer's example
- Vec3D latToSphere(Vec2D ll, float r) {
- Vec3D v = new Vec3D();
- ll = toRadians(ll.x, ll.y);
- v.x = ll.x;
- v.y = ll.y - PI/2;
- v.z = r;
- return(v);
- };
(which returns {x:-1.8056206, y:-0.91642433, z:200.0}} ) draws the Blue line, (once the x and y are multiplied by the globe radius)
(see attached image)
Now, I still haven't put a texture on this example, but the Blue line is looking closer to being positioned at Berlin, at least after I noticed that for some reason in Jer's example that this function
- Vec2D toRadians(float lat, float lon) {
- Vec2D r = new Vec2D();
- r.x = degreesToRadians(-lon) - PI/2;
- r.y = degreesToRadians(-lat) + PI/2;
- return(r);
- };
had the y feeding the longitude calculation and the x feeding the latitude, which seemed inverted, so I switched them...
Still playing around with this, as you can see, but open to thoughts & suggestions... thanks.
~ J