• https://me.yahoo.com
COST (GBP)
0.00
0.00
0

# Position

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

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 <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

 Position( double latitude = 0 double longitude = 0 bool radians = 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.
 latitude The latitude of the position in degrees within the range $\inline&space;&space;[-90,&space;90]$. longitude The longitude of the position in degrees within the range $\inline&space;&space;[-180,&space;180]$. radians A flag to indicate if the longitude and latitude are measured in radians rather than degrees.

#### GetLatitude

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

#### GetLongitude

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

#### SetLatitude

 voidsetLatitude( double latitude bool radians = false )
Assigns a new latitude to the position. By convention, northern latitudes are positive angles and southern latitudes are negative angles.
 latitude The latitude of the position in the range $\inline&space;&space;[-90^\circ&space;,&space;90^\circ]$. radians A flag to indicate if the provided latitude is measured in radians rather than degrees.

#### SetLongitude

 voidsetLongitude( double longitude bool radians = false )
Assigns a new longitude to the position. By convention, eastern longitudes are positive angles and western longitudes are negative angles.
 longitude The longitude of the position in the range $\inline&space;&space;[-180,&space;180]$. radians A flag to indicate if the provided longitude is measured in radians rather than degrees.

#### =

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

### Returns

the address of the current position.