I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
get GPL
COST (GBP)
this unit 0.00
sub units 0.00
+
0
MathsGeometrySpherical

Position

This class manages the coordinate of a point on the surface of any spherical object.
Controller: will

get GPL add to cart

Interface

C++

Class Position

This class hold the position as (latitude, longitude) in radians relative to the center of any spherical object. Storing positions in this way is essential in spherical geometry, and great circle calculations about the earths surface.

Example 1

#include <codecogs/maths/geometry/spherical/latlong.h>
#include <codecogs/maths/geometry/spherical/position.h>
#include <codecogs/maths/geometry/spherical/angulardistance.h>
 
#include <iostream>
 
int main()
{
  Position NewYork(latitude(40,47,0,'N'), longitude(73,58,0,'W'));
  Position London(latitude(51,32,0,'N'), longitude(0,5,0,'W'));
 
  std::cout << "If you stand in NewYork, London is " << distance(NewYork, London, 3951.0881) << "
miles away" << std::endl;
  return 0;
}
Output:
If you stand in NewYork, London is 3451.07 miles away

Authors

John Douglas (Dec, 2005)
Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.

Members of Position

Position

 
Positiondoublelatitude = 0
doublelongitude = 0
boolradians = false )[constructor]
This constructor creates a position using the specified latitude and longitude values. By convention, northern latitudes and eastern longitudes are positive angles and southern latitudes and western longitudes are negative angles.
latitudeThe latitude of the position in degrees within the range [-90, 90].
longitudeThe longitude of the position in degrees within the range [-180, 180].
radiansA flag to indicate if the longitude and latitude are measured in radians rather than degrees.

GetLatitude

 
doublegetLatitudeboolradians = false )
Returns the Latitude of the position in degrees (by default).
radiansA flag to indicate if the returned longitude is in radians rather than degrees.

GetLongitude

 
doublegetLongitudeboolradians = false )
Returns the Longitude of the position in degrees (by default).
radiansA flag to indicate if the returned longitude is in radians rather than degrees.

SetLatitude

 
voidsetLatitudedoublelatitude
boolradians = false )
Assigns a new latitude to the position. By convention, northern latitudes are positive angles and southern latitudes are negative angles.
latitudeThe latitude of the position in the range [-90^\circ , 90^\circ].
radiansA flag to indicate if the provided latitude is measured in radians rather than degrees.

SetLongitude

 
voidsetLongitudedoublelongitude
boolradians = false )
Assigns a new longitude to the position. By convention, eastern longitudes are positive angles and western longitudes are negative angles.
longitudeThe longitude of the position in the range [-180, 180].
radiansA flag to indicate if the provided longitude is measured in radians rather than degrees.

=

 
Position operator&=const Position& rhs )
Copies one position to another
rhsis the position to be copied.

Returns

the address of the current position.