2016-04-02 13 views
3

Bir küre üzerine enlem ve boylam ile koordinatları eşlemeye çalışmak.Enlem ve boylamın bir 3D Sphere ile eşleştirilmesi

İnternetten üç farklı denklem seti denedim ve bunların hiçbiri çalışmıyor. Bunun nasıl yapıldığını bilen var m.

Çalışmama çalıştığım bunlar.

var phi = (90-lat)*(Math.PI/180), 
theta = (lon+180)*(Math.PI/180), 
x = -((radius) * Math.sin(phi)*Math.cos(theta)), 
z = ((radius) * Math.sin(phi)*Math.sin(theta)), 
y = ((radius) * Math.cos(phi)); 

return new THREE.Vector3(x,y,z); 


    var height = 600; 
    var phi = (lat)*Math.PI/180; 
    var theta = (lon-180)*Math.PI/180; 

    var x = -(radius+height) * Math.cos(phi) * Math.cos(theta); 
    var y = (radius+height) * Math.sin(phi); 
    var z = (radius+height) * Math.cos(phi) * Math.sin(theta); 

    return new THREE.Vector3(x,y,z); 



var x = Math.cos(lon) * Math.sin(lat), 
    y = Math.sin(lon) * Math.sin(lat), 
    z = Math.cos(lat); 
return new THREE.Vector3(x,y,z); 

cevap

2

Ah aslında bu kesinlikle çalışır!

var phi = (90-lat)*(Math.PI/180), 
theta = (lon+180)*(Math.PI/180), 
x = -((radius) * Math.sin(phi)*Math.cos(theta)), 
z = ((radius) * Math.sin(phi)*Math.sin(theta)), 
y = ((radius) * Math.cos(phi)); 

return new THREE.Vector3(x,y,z);