psychicdopa.blogg.se

Orcaflex coordinate conversion x vs y
Orcaflex coordinate conversion x vs y




orcaflex coordinate conversion x vs y
  1. #Orcaflex coordinate conversion x vs y how to
  2. #Orcaflex coordinate conversion x vs y code
orcaflex coordinate conversion x vs y orcaflex coordinate conversion x vs y

For instance, on your map, the lat/lon numbers were easy and big differences between gridlines.and i can get that star to go exactly where i want it. 061276 of a point).įrom playing with your flash file and mine, the more decimal places there are on the lat/lon values, the less accurate the star becomes. the difference between my max & min longitude values is only. i looked up the coordinates and the min/max latitude and longitude for the city map i'm using are like a bazillionth of a point apart (ie.

#Orcaflex coordinate conversion x vs y how to

I'm guessing this can be down with a mathematical conversion/equation but i have no clue how to do it. NOW, we need to translate that into an XY position inside the mc with the map graphic in it. So, i'm totally lost (i'm TERRIBLE at math) as to how i can turn latitude/longitude info into X and Y coordinates so that flash can move the little dot around to the right location.įor instance: The following variables are passed into flash: Lat: 32.777654 Long: -79.933819. We have the geographical coordinates in Latitude/Longitude form. I'm working on a map that will display a person's location with a dot. ZPos = (app.radius) * Math.sin(latitude) YPos = (app.radius) * Math.sin(longitude) * s(latitude) XPos = (app.radius) * s(longitude) * s(latitude) Here is the ActionScript that I am using: I assume that the second issue will be easier to solve (relative x, y, z adjustment) once the first issue is resolved - which appears much more variant. I found the calculations for converting LATITUDE and LONGITUDE to X, Y, Z coordinates above, yet I am just not getting accurate results! There are actually 2 issues:ġ) the nodes do not appear to be in correct locations relative to each other (ie., Rome and Johannesburg are right next to each other, and San Francisco and New York City are about half way around the world from eachother!)Ģ) also, the nodes are not not in the right places (ie, New York City is at the South Pole!)

#Orcaflex coordinate conversion x vs y code

You can see and download all the source code here (including the LAT/LONG data): So I am working on an open-source 3D Flash mapping application. It is a constant and a good value is generally around 150-200. Where focal_length is the distance from the xy plane to the viewers eye. Projected_y = y * focal_length / (focal_length + z) Projected_x = x * focal_length / (focal_length + z) This is a little tricker of a concept to grasp so I'll just show the code instead: Now that you have a point (x, y, z) you can project this on to the xy plane. Y = radius_of_world * Math.sin(longitude) * s(latitude) X = radius_of_world * s(longitude) * s(latitude) Y = radius_of_world * sin(longitude) * sin(90 - latitude)Īpplying trig identities and actionscript we get: X = radius_of_world * cos(longitude) * sin(90 - latitude) You can change that to (x,y,z) using formulae 4, 5, and 6 in the link above. So now you've got the spherical coordinate (radius_of_world, longitude, 90 - latitude). This means its like the latitude except instead of being measured from the equator, it's measured from the northpole. is the zenith coordinate or in this case the colatitude. is the azimuth coordinate or in this case the longitude. First you must convert your spherical coordinates into cartesian coordinates, and then you must project them on to the xy plane.ġ) Spherical coordinates are of the form.






Orcaflex coordinate conversion x vs y