You have
Code: x = radians(x) * sin(x-PI) * cos(y-2*PI);
y = -(radians(y)) * cos(x-PI);
z = radians(z) * sin(x-PI) * sin(y-2*PI);
where I had
Code:x = radX * sin(angNS) * cos(angEW);
y = - radY * cos(angNS);
z = radZ * sin(angNS) * sin(angEW);
radX is the radius not radians(x)
also beware you have this which is confusing
Code: float lng;
float lat;
lng = 48.45; //Paris
lat = 2.35;
float x = map(lat, 180, -180, -90, 90);
float y = map(lng, 90, -90, -90, 90);
float z = 90;
Use x,y and z for the coordinates and something else for the 2 angles for latitude and longitude.
The Shapes 3D library has a nice feature where you can add one shape to another which means the relative position between them is constant provided we just move/rotate the primary shape.
In the sketch below I have created a simplified version of your program to demonstrate the techniques.
Code:import peasy.org.apache.commons.math.*;
import peasy.*;
import peasy.org.apache.commons.math.geometry.*;
import shapes3d.utils.*;
import shapes3d.org.apache.commons.math.util.*;
import shapes3d.org.apache.commons.math.*;
import shapes3d.org.apache.commons.math.geometry.*;
import shapes3d.*;
Ellipsoid earth, somewhere;
PeasyCam pcam;
float angNS, angEW;
float x,y,z;
void setup(){
size(400,400,P3D);
pcam = new PeasyCam(this,0,0,0,500);
earth = new Ellipsoid(this,20,20);
earth.setRadius(90);
earth.fill(color(0,128,0));
somewhere = new Ellipsoid(this, 6,10);
somewhere.fill(color(128,0,0));
somewhere.setSize(4);
angNS = radians(60);
angEW = radians(20);
x = 90 * sin(angNS) * cos(angEW);
y = - 90 * cos(angNS);
z = 90 * sin(angNS) * sin(angEW);
somewhere.moveTo(x,y,z);
earth.addShape(somewhere);
}
void draw(){
background(32);
ambientLight(200,200,200);
earth.draw();
}
Good luck