SimApi Convertor localToGlobal

From SIMboxWiki
Revision as of 18:24, 16 March 2010 by Ofirs (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search



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

    Description

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

    Parameters

    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)

    Return

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

    Remarks
    

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
	SimApi::Convertor::localToGlobal(i_X,i_Y,longitude,latitude);

	//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;
}


Output:
-------

Latitude: 35.986200278643537
Longitude: -114.90686179888434


    See Also

     globalToLocal

    Related Links

     SIMbox Coordinates Systems Overview