Coordinate System

From World Wind Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 19:18, 7 January 2008 (edit)
Mkpl (Talk | contribs)
m (New page: ===Coordinate System=== WWJ uses an [http://en.wikipedia.org/wiki/ECEF ECEF] Cartesian coordinate system. Conversions from geodetic (lat, lon, altitude) to Cartesian are computed in the gl...)
← Previous diff
Current revision (21:15, 21 August 2019) (edit) (undo)
F0urtyfive (Talk | contribs)
m (Reverted edits by Monday (Talk); changed back to last version by Asantiago)
 
(7 intermediate revisions not shown.)
Line 1: Line 1:
-===Coordinate System===+==Coordinate System==
 + 
WWJ uses an [http://en.wikipedia.org/wiki/ECEF ECEF] Cartesian coordinate system. Conversions from geodetic (lat, lon, altitude) to Cartesian are computed in the globe class (''EllipsodialGlobe.geodeticToCartesian(...)''), where the conversion is essentially applying an Equirectangular projection (or the reverse in the case of geodeticToCartesian()). WWJ uses WGS84 as a means to establish the center and orientation of the earth. WWJ uses an [http://en.wikipedia.org/wiki/ECEF ECEF] Cartesian coordinate system. Conversions from geodetic (lat, lon, altitude) to Cartesian are computed in the globe class (''EllipsodialGlobe.geodeticToCartesian(...)''), where the conversion is essentially applying an Equirectangular projection (or the reverse in the case of geodeticToCartesian()). WWJ uses WGS84 as a means to establish the center and orientation of the earth.
-When performing custom transformations (in a ''render()'' method for example), the modelview matrix has been transformed to orient the axises to the center of the earth prior to the render call. It's easier to transform geometry using a local world origin, which is established by calling ''View.pushReferenceCenter()'' (the referenceCenter argument is in world coordinates). One must call ''popReferenceCenter()'' afterwards. A call to View.get*Matrix returns the same matrix as if I asked the opengl pipeline for it.+As described in the javadoc of method ''EllipsodialGlobe.geodeticToCartesian(...)'':
 +<code><pre>
 +// The code below maps latitude / longitude position to globe-centered Cartesian coordinates.
 +// The Y axis points to the north pole. The Z axis points to the intersection of the prime
 +// meridian and the equator, in the equatorial plane. The X axis completes a right-handed
 +// coordinate system, and is 90 degrees east of the Z axis and also in the equatorial plane.
 +</pre></code>
-In WWJ the earth rotational axes is Y, with positive values in the northern hemisphere. Z points toward lat/lon zero and X toward lat zero, lon 90 east.+Positions (lat/lon/elev) are transformed to points (represented in Vec4 instances) in the cartesian coordinate system used by OpenGL (see [http://www.colorado.edu/geography/gcraft/notes/coordsys/gif/ecefxyz.gif image]). Next methods transforms from Position to point and from point to Position.
 +<code><pre>
 +Vec4 point = globe.computePointFromPosition(lat, lon, elevation);
 +Position pos = globe.computePositionFromPoint(point);
 +</pre></code>
 + 
 +Once you have a point in cartesian CS you can get the screen position (relative to the canvas) with:
 +<code><pre>
 +Vec4 scr = view.project(point);
 +</pre></code>
 + 
 +When performing custom transformations (in a ''render()'' method for example), the modelview matrix has been transformed to orient the axises to the center of the earth prior to the render call. It's easier to transform geometry using a local world origin, which is established by calling ''View.pushReferenceCenter()'' (the referenceCenter argument is in world coordinates). One must call ''popReferenceCenter()'' afterwards. A call to View.get*Matrix returns the same matrix as if I asked the opengl pipeline for it.
[[Category:WWJ Dev Documentation]] [[Category:WWJ Dev Documentation]]

Current revision

[edit] Coordinate System

WWJ uses an ECEF Cartesian coordinate system. Conversions from geodetic (lat, lon, altitude) to Cartesian are computed in the globe class (EllipsodialGlobe.geodeticToCartesian(...)), where the conversion is essentially applying an Equirectangular projection (or the reverse in the case of geodeticToCartesian()). WWJ uses WGS84 as a means to establish the center and orientation of the earth.

As described in the javadoc of method EllipsodialGlobe.geodeticToCartesian(...):

// The code below maps latitude / longitude position to globe-centered Cartesian coordinates.
// The Y axis points to the north pole. The Z axis points to the intersection of the prime
// meridian and the equator, in the equatorial plane. The X axis completes a right-handed
// coordinate system, and is 90 degrees east of the Z axis and also in the equatorial plane.

Positions (lat/lon/elev) are transformed to points (represented in Vec4 instances) in the cartesian coordinate system used by OpenGL (see image). Next methods transforms from Position to point and from point to Position.

Vec4 point = globe.computePointFromPosition(lat, lon, elevation);
Position pos = globe.computePositionFromPoint(point);

Once you have a point in cartesian CS you can get the screen position (relative to the canvas) with:

Vec4 scr = view.project(point);

When performing custom transformations (in a render() method for example), the modelview matrix has been transformed to orient the axises to the center of the earth prior to the render call. It's easier to transform geometry using a local world origin, which is established by calling View.pushReferenceCenter() (the referenceCenter argument is in world coordinates). One must call popReferenceCenter() afterwards. A call to View.get*Matrix returns the same matrix as if I asked the opengl pipeline for it.