nav_algo.coordinates module

Bases: object

A representation of a latitude/longitude coordinate system.

An object of type CoordinateSystem can be used to initialize a vector inside of a coordinate system with origin at LAT_OFFSET and LONG_OFFSET.

Parameters
  • latitude (float) – The latitude of the origin of the system.

  • longitude (float) – The longitude of the origin of the system.

The latitude of the origin of the system.

Type

float

The longitude of the origin of the system.

Type

float

The radius of the Earth (in meters).

Type

float

Bases: object

A representation of 2D vectors with a coordinate system.

To construct a position vector, pass in a CoordinateSystem and a latitude and longitude. To specify only the x and y components, pass in x and y. Alternatively, to construct a unit vector with a given angle, pass in an angle.

Parameters
  • coord_sys (CoordinateSystem) – (Optional) The coordinate system in which the vector lies.

  • latitude (float) – (Optional) The latitude of the position.

  • longitude (float) – (Optional) The longitude of the position.

  • angle (float) – (Optional) The angle (in degrees) used to construct a unit vector.

  • x (float) – (Optional) The x component of the vector.

  • y (float) – (Optional) The y component of the vector.

The x component of the vector.

Type

float

The y component of the vector.

Type

float

(Optional) The coordinate system in which the vector lies.

Type

CoordinateSystem

(Optional) The latitude of the position.

Type

float

(Optional) The longitude of the position.

Type

float

Calculates the anglular distance between the vector and the x-axis.

The returned angle is between 0 and 360 degrees.

Returns

The angle between the vector and North.

Return type

float

Calculates the dot product of two vectors.

Parameters

other (Vector) – The vector to dot with ‘self’.

Returns

The dot product of ‘self’ and ‘other’.

Return type

float

Constructs the inverse of a vector.

Returns

The inverse of the original vector.

Return type

Vector

Calculates the magnitude of a vector.

Returns

The magnitude of the vector.

Return type

float

Calculates the midpoint between two positions.

Parameters

other (Vector) – The second position vector.

Returns

The position vector midpoint between ‘self’ and ‘other’.

Return type

Vector

Converts a vector to a unit vector.

Returns

A unit vector representation of the input vector.

Return type

Vector

Calculates the vector difference between two vectors.

Parameters

other (Vector) – The vector to subtract from ‘self’.

Returns

The vector difference between ‘self’ and ‘other’.

Return type

Vector

Calculates the distance between two positions.

Parameters

other (Vector) – The second position in the distance calculation.

Returns

The distance between ‘self’ and ‘other’.

Return type

float

Constructs a zero vector.

Returns

A vector with zero magnitude.

Return type

Vector

Converts from degrees to radians.

Parameters

angle (float) – An angle in degrees.

Returns

The angle in radians.

Return type

float

Converts from radians to degrees.

Parameters

angle (float) – An angle in radians.

Returns

The angle in degrees.

Return type

float

Puts an angle with the range of 0 to 360.

Parameters

angle (float) – An angle in degrees.

Returns

An angle within the range of 0 to 360.

Return type

float