SimApi Convertor localToGlobal

From SIMboxWiki
Jump to navigation Jump to search

Icon attributes.pngstatic void SimApi::Convertor::localToGlobal(const float &x, const float &y, double &longitude, double &latitude)


    Converts world local coordinates to world global coordinates (by default- WGS84 format).


    x - The X coordinate of world local coordinates system (meters)
    y - The Y coordinate of world local coordinates system (meters)
    longitude - The longitude world global coordinate (radians)
    latitude - The latitude world global coordinate (radians)


    Type: void   Description: Global coordinates in the longitude,latitude parameters


Simulation uses SIMBox (local) coordinate system called 'World Local' for position representation and computation. Often position of an object is requiered to be represented 'World Global' coordinates. In order to get WGS84 representation a conversion from 'WorldLocal' coordinates that are used by SIMBox simulation API to WGS84 format is needed. See "SIMBox Coordinates Systems" for more information.

    Code Sample

	        void MyConversion(float i_X, float i_Y)
	double latitude = 0.0;
	double longitude = 0.0;

	//convert world local position coordinates to world global coordinates

	//Convert from radians to degrees
	latitude = latitude * 180 / PI;
	longitude = longitude * 180 / PI;

	//print results
	cout<<"Longitude: "<<longitude<<endl;
	cout<<"Latitude: "<<latitude<<endl;

int main(int argc, char* argv[])
	//position x,y
	float x = 1000;
	float y = 1000;
	MyConversion(x, y);
	return 0;


Latitude: 35.986200278643537
Longitude: -114.90686179888434

    See Also


    Related Links

     SIMbox Coordinates Systems Overview