ICAROUS
|
#include <Position.h>
Public Member Functions | |
Position () | |
Position (const LatLonAlt &lla) | |
Position (const Vect3 &v) | |
Position (const Position &p) | |
bool | almostEquals (const Position &v) const |
bool | almostEquals (const Position &pp, double epsilon_horiz, double epsilon_vert) const |
bool | almostEquals2D (const Position &pp, double epsilon_horiz) const |
bool | operator== (const Position &v) const |
bool | operator!= (const Position &v) const |
Vect2 | vect2 () const |
const Vect3 & | vect3 () const |
const LatLonAlt & | lla () const |
bool | isInvalid () const |
double | x () const |
double | y () const |
double | z () const |
double | lat () const |
double | lon () const |
double | alt () const |
double | latitude () const |
double | longitude () const |
double | altitude () const |
double | xCoordinate () const |
double | yCoordinate () const |
double | zCoordinate () const |
bool | isLatLon () const |
const Position | mkX (const double xx) const |
const Position | mkLon (const double lon) const |
const Position | mkY (const double yy) const |
const Position | mkLat (const double lat) const |
const Position | mkZ (const double zz) const |
const Position | mkAlt (const double alt) const |
const Position | zeroAlt () const |
double | distanceH (const Position &p) const |
double | distanceV (const Position &p) const |
double | signedDistanceV (const Position &p) const |
const Position | linear (const Velocity &v, double time) const |
const Position | linearEst (double dn, double de) const |
const Position | linearEst (const Velocity &vo, double time) const |
const std::pair< Position, Velocity > | linearDist2D (double track, double d, double gsAt_d) const |
const Position | linearDist2D (double track, double d) const |
const Position | midPoint (const Position &p2) const |
Position | interpolate (const Position &p2, double f) const |
double | track (const Position &p) const |
Velocity | initialVelocity (const Position &p2, double time) const |
Velocity | finalVelocity (const Position &p2, double time) const |
double | representativeTrack (const Position &p) const |
Velocity | averageVelocity (const Position &p2, double speed) const |
Velocity | avgVelocity (const Position &p2, double dt) const |
bool | isWest (const Position &a) const |
bool | LoS (const Position &p2, double D, double H) |
bool | collinear (Position p1, Position p2) const |
std::string | toUnitTest () const |
std::string | toUnitTestSI () const |
std::string | toString () const |
std::string | toString (int prec) const |
std::string | toString2D (int prec) const |
std::string | toStringUnits (const std::string &xunit, const std::string &yunit, const std::string &zunit) const |
std::vector< std::string > | toStringList () const |
std::vector< std::string > | toStringList (int precision) const |
std::vector< std::string > | toStringList (int precision, int latLonExtraPrecision, bool internalUnits) const |
std::string | toStringNP () const |
std::string | toStringNP (int precision) const |
Static Public Member Functions | |
static Position | makeLatLonAlt (double lat, double lon, double alt) |
static Position | makeLatLonAlt (double lat, std::string lat_unit, double lon, std::string lon_unit, double alt, std::string alt_unit) |
static Position | mkLatLonAlt (double lat, double lon, double alt) |
static Position | makeXYZ (double x, double y, double z) |
static Position | mkXYZ (double x, double y, double z) |
static Position | makeXYZ (double x, std::string x_unit, double y, std::string y_unit, double z, std::string z_unit) |
static Position | make (const LatLonAlt &lla) |
static Position | make (const Vect3 &p) |
static const Position & | ZERO_LL () |
static const Position & | ZERO_XYZ () |
static const Position & | INVALID () |
static std::pair< Position, double > | intersection (const Position &so, const Velocity &vo, const Position &si, const Velocity &vi) |
static std::pair< Position, double > | intersection (const Position &so, const Position &so2, double dto, const Position &si, const Position &si2) |
static Position | intersection2D (const Position &so, const Position &so2, const Position &si, const Position &si2) |
static const Position | parseLL (const std::string &s) |
static const Position | parseXYZ (const std::string &s) |
static const Position | parse (const std::string &s) |
Private Member Functions | |
Position (const double x, const double y, const double z) | |
Private Attributes | |
bool | latlon |
LatLonAlt | ll |
Vect3 | s3 |
This class captures a single position represented in either Euclidean or Lat/Lon coordinates.
This class is immutable.
This class is designed to be resilient; The methods do not return errors when a position in the "wrong" geometry is provided. So the method x() will return a value even when the original position was provided in LatLonAlt.
The correspondence is as follows:
larcfm::Position::Position | ( | ) |
Create an empty Position object
|
explicit |
|
explicit |
bool larcfm::Position::almostEquals | ( | const Position & | pp, |
double | epsilon_horiz, | ||
double | epsilon_vert | ||
) | const |
bool larcfm::Position::almostEquals | ( | const Position & | v | ) | const |
bool larcfm::Position::almostEquals2D | ( | const Position & | pp, |
double | epsilon_horiz | ||
) | const |
pp | |
epsilon_horiz | max distance in meters |
double larcfm::Position::alt | ( | ) | const |
Return the altitude
double larcfm::Position::altitude | ( | ) | const |
Return the altitude in feet
Return the average velocity between the current position and the given position, with the given speed [internal units].
p2 | another position |
speed | the ground speed going from this Position to the given position |
Return the average velocity between the current position and the given position, with the given speed [internal units].
Return the average velocity between the current position and the given position, with the given delta time dt.
p2 | another position |
dt | delta time |
Return the average velocity between the current position and the given position, with the given delta time dt.
double larcfm::Position::distanceH | ( | const Position & | p | ) | const |
double larcfm::Position::distanceV | ( | const Position & | p | ) | const |
return the velocity going from this to p over dt seconds. Returns a ZERO velocity if dt <= 0
|
static |
Returns intersection point and time of intersection relative to the time of position so for time return value, it assumes that an aircraft travels from so1 to so2 in dto seconds and the other aircraft from si to si2 a negative time indicates that the intersection occurred in the past (relative to directions of travel of so1)
|
static |
Returns intersection point between two lines defined by the four positions. If the Postions are LatLonAlt then the lines are Great Circle lines, otherwise they are infinite lines in Euclidean space.
so | first point of infinite line A |
so2 | second point of infinite line A |
si | first point of infinite line B |
si2 | second point of infinite line B |
Returns intersection point and time of intersection relative to the time of position so for time return value, it assumes that an aircraft travels from so1 to so2 in dto seconds and the other aircraft from si to si2 a negative time indicates that the intersection occurred in the past (relative to directions of travel of so1)
bool larcfm::Position::isInvalid | ( | ) | const |
Returns true if this Position is invalid
bool larcfm::Position::isLatLon | ( | ) | const |
Return if this Position is a latitude or longitude
bool larcfm::Position::isWest | ( | const Position & | a | ) | const |
Return true if this point is west of the given point (this.x < a.x)
a | other point |
double larcfm::Position::lat | ( | ) | const |
Return the latitude
double larcfm::Position::latitude | ( | ) | const |
Return the latitude in degrees north
Perform a linear projection of the current Position with given velocity and time. If isLatLon() is true, then a great circle route is followed and the velocity represents the initial velocity along the great circle.
Reminder: If this is used in a stepwise fashion over lat/lon, be careful when passing over or near the poles and keep the velocity track in mind.
v | the velocity |
time | the time from the current point Note: using a negative time value is the same a velocity moving in the opposite direction (along the great circle, if appropriate) |
const Position larcfm::Position::linearDist2D | ( | double | track, |
double | d | ||
) | const |
Returns a new position in the given direction at the given distance from this point The altitude is not changed!
track | track |
d | distance |
Perform a estimation of a linear projection of the current Position with the given velocity and time.
vo | the velocity |
time | the time from the current point |
const Position larcfm::Position::linearEst | ( | double | dn, |
double | de | ||
) | const |
Calculate a new position that is offset from the current position by (dn,de)
dn | offset in north direction (m) |
de | offset in east direction (m) |
double larcfm::Position::lon | ( | ) | const |
Return the longitude
double larcfm::Position::longitude | ( | ) | const |
Return the longitude in degrees east
bool larcfm::Position::LoS | ( | const Position & | p2, |
double | D, | ||
double | H | ||
) |
Determine if a loss of separation has occurred (using either geodesic or Euclidean calculations)
p2 | the position of the other aircraft |
D | horizontal distance to specify loss of separation |
H | vertical distance to specify loss of separation |
|
static |
Creates a new lat/lon position with coordinates (lat
,lon
,alt
).
lat | latitude [deg north latitude] |
lon | longitude [deg east longitude] |
alt | altitude [ft] |
|
static |
Creates a new lat/lon position with coordinates (lat
,lon
,alt
).
lat | latitude [lat_unit north latitude] |
lat_unit | units of latitude |
lon | longitude [lon_unit east longitude] |
lon_unit | units of latitude |
alt | altitude [alt_unit] |
alt_unit | units of altitude |
|
static |
Creates a new Euclidean position with coordinates (x
,y
,z
).
x | coordinate [nmi] |
y | coordinate [nmi] |
z | altitude [ft] |
|
static |
Creates a new Euclidean position with coordinates (x
,y
,z
).
x | coordinate [x_unit] |
x_unit | units of x coordinate |
y | coordinate [y_unit] |
y_unit | units of y coordinate |
z | altitude [z_unit] |
z_unit | units of z coordinate |
Return the mid point between the current position and the given position
p2 | the other position |
const Position larcfm::Position::mkAlt | ( | const double | alt | ) | const |
const Position larcfm::Position::mkLat | ( | const double | lat | ) | const |
|
static |
Creates a new lat/lon position with coordinates (lat
,lon
,alt
).
lat | latitude [radians] |
lon | longitude [radians] |
alt | altitude [m] |
const Position larcfm::Position::mkLon | ( | const double | lon | ) | const |
const Position larcfm::Position::mkX | ( | const double | xx | ) | const |
Make a new Position from the current one with the X coordinate changed
|
static |
Creates a new Euclidean position with coordinates (x
,y
,z
).
x | coordinate [m] |
y | coordinate [m] |
z | altitude [m] |
const Position larcfm::Position::mkY | ( | const double | yy | ) | const |
Make a new Position from the current one with the Y coordinate changed
const Position larcfm::Position::mkZ | ( | const double | zz | ) | const |
Make a new Position from the current one with the Z coordinate changed
bool larcfm::Position::operator!= | ( | const Position & | v | ) | const |
Are these two positions unequal?
bool larcfm::Position::operator== | ( | const Position & | v | ) | const |
Are these two positions equal?
|
static |
|
static |
This interprets a string as a LatLonAlt position with units in deg/deg/ft or the specified units (inverse of toString())
s | string to parse |
This interprets a string as a LatLonAlt position with units of deg/deg/ft or in the specified units (inverse of toString())
|
static |
This interprets a string as a XYZ position with units in NM/NM/ft or the specified units (inverse of toString())
s | string to parse |
This interprets a string as a XYZ position with units of nmi/nmi/ft or in the specified units (inverse of toString())
double larcfm::Position::representativeTrack | ( | const Position & | p | ) | const |
double larcfm::Position::signedDistanceV | ( | const Position & | p | ) | const |
std::string larcfm::Position::toString | ( | ) | const |
Return a string representation
std::string larcfm::Position::toString | ( | int | prec | ) | const |
Return a string representation
prec | digits of precision |
std::string larcfm::Position::toString2D | ( | int | prec | ) | const |
Return a string representation
prec | digits of precision |
std::string larcfm::Position::toStringNP | ( | ) | const |
Return a string representation with a default precision but without parentheses.
std::string larcfm::Position::toStringNP | ( | int | precision | ) | const |
Return a string representation, with a user-specified digits of precision (0-15) without units or parentheses.
precision | digits of precision |
std::string larcfm::Position::toStringUnits | ( | const std::string & | xunit, |
const std::string & | yunit, | ||
const std::string & | zunit | ||
) | const |
Return a string representation using the given unit conversions (latitude and longitude, if appropriate, are always in degrees, so only the z unit is used in that case)
Return a string representation using the given unit conversions (latitude and longitude, if appropriate, are always in degrees, so only the z unit is used in that case).
double larcfm::Position::track | ( | const Position & | p | ) | const |
Vect2 larcfm::Position::vect2 | ( | ) | const |
Return the horizontal position as a standard vect2(). This returns either (x,y), or, equivalently, (lon, lat).
const Vect3 & larcfm::Position::vect3 | ( | ) | const |
Return the three dimensional position vector
double larcfm::Position::x | ( | ) | const |
Return the x coordinate
double larcfm::Position::xCoordinate | ( | ) | const |
Return the x coordinate in [NM]
double larcfm::Position::y | ( | ) | const |
Return the y coordinate
double larcfm::Position::yCoordinate | ( | ) | const |
Return the y coordinate in [NM]
double larcfm::Position::z | ( | ) | const |
Return the z coordinate
double larcfm::Position::zCoordinate | ( | ) | const |
Return the z coordinate in [ft]
|
static |
Zero latitude, longitude and altitude
|
static |
Zero x, y, and z
const Position larcfm::Position::zeroAlt | ( | ) | const |