Skip to main content

GeoBasis

The GeoBasis plugin represents a geodetic reference system for a celestial body, defining the geometric and physical parameters of its ellipsoidal shape used in geographic computations. It supports multiple planetary bodies such as Earth, Mars, and Moon by specifying their ellipsoid parameters, and provides conversion methods between Cartesian (3D spatial) and geographic (longitude, latitude, elevation) coordinate systems.

  • GeoVector2d class represents a 2D geographic coordinate composed of longitude and latitude.
  • GeoVector3d class represents a 3D geographic coordinate composed of longitude, latitude, and elevation.
  • GeoRectd class represents a 2D geographic bounding rectangle defined by two corner points in longitude and latitude coordinates.
  • GeoBoxd class represents a 3D geographic bounding volume defined by two corner points in longitude, latitude, and elevation coordinates.
#include <geospatial/geobasis/include/TellusimGeoBasis.h>
#include <geospatial/geobasis/include/TellusimGeoBounds.h>
#include <geospatial/geobasis/include/TellusimGeoVector.h>

Example

The following example demonstrates how to use the GeoBasis plugin to convert geographic coordinates for specific locations on Earth into Cartesian 3D coordinates and then convert them back to geographic coordinates.

GeoBasis basis(GeoBasis::TypeEarth);

GeoVector3d vectors[] = {
GeoVector3d( 2.29448600162041, 48.85829222199122, 10.0),
GeoVector3d(-43.21048393860634, -22.95197188897018, 10.0),
};

for(uint32_t i = 0; i < TS_COUNTOF(vectors); i++) {

GeoVector3d vector = vectors[i];
Vector3d position_2 = basis.getVector3d(GeoVector2d(vector));
Vector3d position_3 = basis.getVector3d(GeoVector3d(vector));

GeoVector2d vector_2 = basis.getGeoVector2d(position_2);
GeoVector3d vector_3 = basis.getGeoVector3d(position_3);

Log::print("\n");

TS_LOGF(Message, "%.8f %.8f %.8f\n", vector.lon, vector.lat, vector.z);
TS_LOGF(Message, "%.8f %.8f %.8f - %.8f %.8f\n", position_2.x, position_2.y, position_2.z, vector_2.lon, vector_2.lat);
TS_LOGF(Message, "%.8f %.8f %.8f - %.8f %.8f %.8f\n", position_3.x, position_3.y, position_3.z, vector_3.lon, vector_3.lat, vector_3.z);
}