Re: How do I convert Longitude/Latitude/Altitude to XYZ Coordinates? (starter info included)
- From: Ultrus <owntheweb@xxxxxxxxx>
- Date: Tue, 5 Aug 2008 15:35:57 -0700 (PDT)
On Aug 5, 3:36 pm, Ultrus <ownthe...@xxxxxxxxx> wrote:
On Aug 5, 2:43 pm, Ray Vickson <RGVick...@xxxxxxx> wrote:
On Aug 5, 12:22 pm, Ultrus <ownthe...@xxxxxxxxx> wrote:
Hello,
For a fun project in Flash, I'm plotting satellites in 3D space. I'm
able to generate the longitude, latitude, and altitude for a
satellite, and need to convert it into X, Y, and Z coordinates to show
up in my project. I'm not too worried about supreme accuracy, so I
don't need to mess with the non-perfect roundness of the earth and
other precession items.
Here's what I know so far:
*Altitude is the distance a point is away from sea level.
*Latitude measures vertically on the Earth, with values ranging from
-90 to 90.
*Longitude measures horizontally on the Earth, with values ranging
from -180 to 180.
*c = a squared + b squared
*c = 6378.1km (Earth radius) + altitude, (altitude is often referred
to as h in math formulas)
Now for X, Y, and Z, I'm guessing there is some sin and cos involved,
and more basic triangle fun. This runs over my head sometimes more
than other times. Today it's as high as a satellite and I can't see
it.
Any clues on how to proceed? I appreciate any feedback you can
provide. :)
Thank you,
Is your (X,Y,Z) coordinate system rotating with the Earth? If so, you
just need to convert form "spherical" to rectangular coordinates. See,
eg.,http://en.wikipedia.org/wiki/Spherical_coordinate_system. In
context of that article, the origin would be at the center of the
Earth and the z-axis would go through the north pole. Angle phi would
be the longitude and (90 - theta) degrees would be the latitude,
because theta measures the angle from the north pole rather than from
the equator. The value of r = (Earth radius + altitude). So, the
conversion is x = r*sin(theta)*cos(phi), y = r*sin(theta)*sin(phi) and
z = r*cos(theta).
R.G. Vickson
Rotwang, Ray,
Thanks for the info! When I get a concept working, I'll post the
results.
Rotwang,
I appreciate you posting and reversing those formulas. That made my
time MUCH less hectic, and more creative!
Ray,
Yes, I think I will have the satellites rotate with the Earth, at
least eventually. The other option would be to rotate my "scene" at
the speed of the Earth, which would rotate everything at once. That
would reduce calculation load in my script classes. In any case,
thanks for thinking of that and sharing!
Enough rambling from me. Off to work. :)
Whoa.. Here's a curve ball. The longitude and latitude I'm getting is
"elciptic". The coordinates look like this: 51:33:54.9 -122:28:37.8.
I'm looking into how to convert these values to the typical decimal
values I'm used to seeing. I should be able to get it, but let me know
if this sparks any other thoughts. :D
.
- Follow-Ups:
- References:
- How do I convert Longitude/Latitude/Altitude to XYZ Coordinates? (starter info included)
- From: Ultrus
- Re: How do I convert Longitude/Latitude/Altitude to XYZ Coordinates? (starter info included)
- From: Ray Vickson
- Re: How do I convert Longitude/Latitude/Altitude to XYZ Coordinates? (starter info included)
- From: Ultrus
- How do I convert Longitude/Latitude/Altitude to XYZ Coordinates? (starter info included)
- Prev by Date: Re: question about RH
- Next by Date: Re: question about taking limit
- Previous by thread: Re: How do I convert Longitude/Latitude/Altitude to XYZ Coordinates? (starter info included)
- Next by thread: Re: How do I convert Longitude/Latitude/Altitude to XYZ Coordinates? (starter info included)
- Index(es):
Relevant Pages
|