[Papervision3D] Conversion between Spherical and Cartesian Coordinates Systems
mlecho
mlecho at yahoo.com
Thu Jun 4 22:04:28 PDT 2009
hey there, i just went through the same thing using google maps, but in
reverse....i wanted sphere to cartisan, so perhaps you can reverse this
math?
var fauxRadius:Number = 800
var tg:MapTile3D = e.target as MapTile3D;
var latlng:LatLng = tg.extra.latlng as LatLng;//in true degrees
var phi:Number = (90-latlng.lat())*Math.PI/180;
var theta:Number = (latlng.lng())*Math.PI/180;
var dx = -phi* fauxRadius;
var dy = theta * fauxRadius;
tg.x = dx;
tg.y = dy;
brawlis wrote:
>
> Hello
>
> I have problems with conversion from certisan to spherical coordinate
> systems.
>
> I used formula from wikipedia
> http://en.wikipedia.org/wiki/Spherical_coordinates
> but nothing, then I tried:
> public function InverseCordinates(x:Number,y:Number,z:Number):Number2D{
> var cordinates:Number2D = new Number2D(0,0);
> cordinates.x = Math.atan2(x,z)/(2*Math.PI);
> if(cordinates.x < 0){
> cordinates.x += 1;
> }
> cordinates.y = Math.atan2(Math.sqrt(x*x+z*z),y)/Math.PI;
>
> return cordinates;
> }
>
> But nothing :( :(
>
--
View this message in context: http://www.nabble.com/Conversion-between-Spherical-and-Cartesian-Coordinates-Systems-tp23811651p23881219.html
Sent from the Papervision3D mailing list archive at Nabble.com.
More information about the Papervision3D
mailing list