ICAROUS
All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Modules Pages
Public Member Functions | Static Public Member Functions | Private Member Functions | List of all members
larcfm::Velocity Class Reference

#include <Velocity.h>

Inheritance diagram for larcfm::Velocity:
larcfm::Vect3

Public Member Functions

 Velocity ()
 
 Velocity (const Vect3 &v3)
 
double angle (const std::string &uangle) const
 
double angle () const
 
double trk () const
 
double track (const std::string &utrk) const
 
double compassAngle () const
 
double compassAngle (const std::string &u) const
 
double gs () const
 
double groundSpeed (const std::string &ugs) const
 
double vs () const
 
double verticalSpeed (const std::string &uvs) const
 
bool compare (const Velocity &v, double maxTrk, double maxGs, double maxVs)
 
bool compare (const Velocity &v, double horizDelta, double vertDelta)
 
Velocity mkAddTrk (double trk) const
 
Velocity mkTrk (double trk) const
 
Velocity mkTrk (double trk, std::string u) const
 
Velocity mkGs (double gs) const
 
Velocity mkGs (double gs, std::string u) const
 
Velocity mkVs (double vs) const
 
Velocity mkVs (double vs, std::string u) const
 
Velocity NegV () const
 
Velocity zeroSmallVs (double threshold) const
 
std::string toUnitTest () const
 
std::string toString () const
 
std::string toString (int prec) const
 
std::string toStringUnits () const
 
std::string toStringUnits (const std::string &trkUnits, const std::string &gsUnits, const std::string &vsUnits) const
 
std::string toStringXYZ () const
 
std::string toStringXYZ (int prec) const
 
std::vector< std::string > toStringList () const
 
std::vector< std::string > toStringList (int precision) const
 
std::vector< std::string > toStringXYZList () const
 
std::vector< std::string > toStringXYZList (int precision) const
 
std::string toStringNP () const
 
std::string toStringNP (int precision) const
 
std::string toStringNP (const std::string &utrk, const std::string &ugs, const std::string &uvs, int precision) const
 
- Public Member Functions inherited from larcfm::Vect3
 Vect3 (const double xx=0, const double yy=0, const double zz=0)
 
 Vect3 (const Vect2 &v, const double vz)
 
virtual ~Vect3 ()
 
Vect3 mkX (double nx)
 
Vect3 mkY (double ny)
 
Vect3 mkZ (double nz)
 
bool isZero () const
 
bool almostEquals (const Vect3 &v) const
 
bool almostEquals2D (const Vect3 &v, double horizEps) const
 
bool almostEquals (const Vect3 &v, INT64FM maxUlps) const
 
bool within_epsilon (const Vect3 &v2, double epsilon) const
 
Vect3 operator+ (const Vect3 &v) const
 
Vect3 operator- (const Vect3 &v) const
 
Vect3 operator- () const
 
Vect3 operator* (const double k) const
 
double operator* (const Vect3 &v) const
 
bool operator== (const Vect3 &v) const
 
bool operator!= (const Vect3 &v) const
 
Vect3 ScalAdd (const double k, const Vect3 &v) const
 
Vect3 AddScal (double k, const Vect3 &v) const
 
Vect3 PerpR () const
 
Vect3 PerpL () const
 
Vect3 linear (const Vect3 &v, double t) const
 
Vect3 linearByDist2D (double track, double d) const
 
Vect2 vect2 () const
 
Vect3 Hat () const
 
Vect3 cross (const Vect3 &v) const
 
bool parallel (const Vect3 &v) const
 
Vect3 Add (const Vect3 &v) const
 
Vect3 Sub (const Vect3 &v) const
 
Vect3 Neg () const
 
Vect3 Scal (double k) const
 
double dot (const double x, const double y, const double z) const
 
double dot (const Vect3 &v) const
 
double sqv () const
 
double norm () const
 
double det2D (const Vect3 &v) const
 
double dot2D (const Vect3 &v) const
 
double sqv2D () const
 
double norm2D () const
 
Vect3 Hat2D () const
 
double cyl_norm (const double d, const double h) const
 
double distanceH (const Vect3 &w) const
 
double distanceV (const Vect3 &w) const
 
std::string toString () const
 
std::string toString (int precision) const
 
std::string toStringNP (const std::string &xunit, const std::string &yunit, const std::string &zunit) const
 
std::string toStringNP (const std::string &xunit, const std::string &yunit, const std::string &zunit, int precision) const
 
std::string formatXYZ (const std::string &pre, const std::string &mid, const std::string &post) const
 
std::string formatXYZ (int prec, const std::string &pre, const std::string &mid, const std::string &post) const
 
std::string toPVS () const
 
std::string toPVS (int precision) const
 
bool isInvalid () const
 

Static Public Member Functions

static Velocity make (const Vect3 &v)
 
static Velocity make (const Vect2 &v)
 
static Velocity mkVxyz (const double vx, const double vy, const double vz)
 
static Velocity makeVxyz (const double vx, const double vy, const double vz)
 
static Velocity makeVxyz (const double vx, const double vy, const std::string &uvxy, const double vz, const std::string &uvz)
 
static Velocity mkTrkGsVs (const double trk, const double gs, const double vs)
 
static Velocity makeTrkGsVs (const double trk, const double gs, const double vs)
 
static Velocity makeTrkGsVs (const double trk, const std::string &utrk, const double gs, const std::string &ugs, const double vs, const std::string &uvs)
 
static Velocity mkVel (const Vect3 &p1, const Vect3 &p2, double speed)
 
static double track (const Vect3 &p1, const Vect3 &p2)
 
static Velocity genVel (const Vect3 &p1, const Vect3 &p2, double dt)
 
static const VelocityZEROV ()
 
static const VelocityINVALIDV ()
 
static double trkgs2vx (double trk, double gs)
 
static double trkgs2vy (double trk, double gs)
 
static Vect2 trkgs2v (double trk, double gs)
 
static Velocity parseXYZ (const std::string &str)
 
static Velocity parse (const std::string &str)
 
- Static Public Member Functions inherited from larcfm::Vect3
static Vect3 mk (double x, double y, double z)
 
static Vect3 makeXYZ (double x, std::string ux, double y, std::string uy, double z, std::string uz)
 
static Vect3 mkXYZ (double x, double y, double z)
 
static Vect3 make (double x, double y, double z)
 
static Vect3 make (double x, const std::string &xunits, double y, const std::string &yunits, double z, const std::string &zunits)
 
static double tcpa (const Vect3 &so, const Vect3 &vo, const Vect3 &si, const Vect3 &vi)
 
static const Vect3ZERO ()
 
static const Vect3INVALID ()
 
static Vect3 parse (const std::string &s)
 

Private Member Functions

 Velocity (const double vx, const double vy, const double vz)
 

Additional Inherited Members

- Public Attributes inherited from larcfm::Vect3
double x
 
double y
 
double z
 

Detailed Description

This class represents a 3-dimensional velocity vector. The components of the vector represent East-North-Up (ENU) coordinates; thus x is positive in the east direction, y is positive in the north, and z is positive up. The other right handed coordinate system, East-North-Down can probably be used without error, but this has not be tested very well. The track angle is defined by the "true north, clockwise convention."

Constructor & Destructor Documentation

◆ Velocity() [1/2]

larcfm::Velocity::Velocity ( const double  vx,
const double  vy,
const double  vz 
)
private

Instantiates a new velocity in internal units.

Parameters
vxthe vx
vythe vy
vzthe vz

◆ Velocity() [2/2]

larcfm::Velocity::Velocity ( )

Instantiates a zero velocity.

Member Function Documentation

◆ angle() [1/2]

double larcfm::Velocity::angle ( ) const

Angle in radians in the range [-Math.PI, Math.PI]. Convention is counter-clockwise with respect to east.

Returns
the track angle [rad]

◆ angle() [2/2]

double larcfm::Velocity::angle ( const std::string &  uangle) const

Angle in explicit units in corresponding range [-Math.PI, Math.PI]. Convention is counter-clockwise with respect to east.

Parameters
uanglethe explicit units of track angle
Returns
the track angle [rad]

◆ compare() [1/2]

bool larcfm::Velocity::compare ( const Velocity v,
double  horizDelta,
double  vertDelta 
)

Compare two velocities based on horizontal and vertical components. This could be used against a set of nacV ADS-B limits, for example.

Parameters
vother Velocity
horizDeltahorizontal tolerance (absolute value)
vertDeltavertical tolerance (absolute value)
Returns
true if the velocities are within both horizontal and vertical tolerances of each other.

◆ compare() [2/2]

bool larcfm::Velocity::compare ( const Velocity v,
double  maxTrk,
double  maxGs,
double  maxVs 
)

Compare Velocities: return true iff delta is within specified limits

Parameters
vthe other velocity
maxTrkmaximum track
maxGsmaximum gs
maxVsmaximum vs
Returns
true, if the velocities compare correctly

◆ compassAngle() [1/2]

double larcfm::Velocity::compassAngle ( ) const

Compass angle in radians in the range [0, 2*Math.PI). Convention is clockwise with respect to north.

Returns
the compass angle [rad]

◆ compassAngle() [2/2]

double larcfm::Velocity::compassAngle ( const std::string &  u) const

Compass angle in explicit units in corresponding range [0, 2*Math.PI). Convention is clockwise with respect to north.

Parameters
uthe explicit units of compass angle
Returns
the compass angle [u]

◆ genVel()

Velocity larcfm::Velocity::genVel ( const Vect3 p1,
const Vect3 p2,
double  dt 
)
static

Return the velocity if moving from p1 to p2 over the given time

Parameters
p1first point
p2second point
dttime
Returns
the velocity

◆ groundSpeed()

double larcfm::Velocity::groundSpeed ( const std::string &  ugs) const

Ground speed in explicit units.

Parameters
ugsthe explicit units of ground speed
Returns
the ground speed [ugs]

◆ gs()

double larcfm::Velocity::gs ( ) const

Ground speed in internal units.

Returns
the ground speed

◆ INVALIDV()

const Velocity & larcfm::Velocity::INVALIDV ( )
static

An invalid velocity, used for error reporting

◆ make() [1/2]

Velocity larcfm::Velocity::make ( const Vect2 v)
static

New velocity from Vect2 (setting the vertical speed to 0.0).

Parameters
vthe 2-D velocity vector (in internal units).
Returns
the velocity

◆ make() [2/2]

Velocity larcfm::Velocity::make ( const Vect3 v)
static

New velocity from Vect3 in internal units.

Parameters
vthe 3-D velocity vector [mps,mps,mps]
Returns
the velocity

◆ makeTrkGsVs() [1/2]

Velocity larcfm::Velocity::makeTrkGsVs ( const double  trk,
const double  gs,
const double  vs 
)
static

New velocity from Track, Ground Speed, and Vertical speed in explicit units. Note that this uses trigonometric functions, and may introduce numeric instability.

Parameters
trkthe track angle [deg]
gsthe ground speed [knot]
vsthe vertical speed [fpm]
Returns
the velocity

◆ makeTrkGsVs() [2/2]

Velocity larcfm::Velocity::makeTrkGsVs ( const double  trk,
const std::string &  utrk,
const double  gs,
const std::string &  ugs,
const double  vs,
const std::string &  uvs 
)
static

New velocity from Track, Ground Speed, and Vertical speed in explicit units. Note that this uses trigonometric functions, and may introduce numeric instability.

Parameters
trkthe track angle [utrk]
utrkthe units of trk
gsthe ground speed [ugs]
ugsthe units of gs
vsthe vertical speed [uvs]
uvsthe units of vs
Returns
the velocity

◆ makeVxyz() [1/2]

Velocity larcfm::Velocity::makeVxyz ( const double  vx,
const double  vy,
const double  vz 
)
static

New velocity from Euclidean coordinates in "conventional" units.

Parameters
vxthe x-velocity [knot]
vythe y-velocity [knot]
vzthe z-velocity [fpm]
Returns
the velocity

◆ makeVxyz() [2/2]

Velocity larcfm::Velocity::makeVxyz ( const double  vx,
const double  vy,
const std::string &  uvxy,
const double  vz,
const std::string &  uvz 
)
static

New velocity from Euclidean coordinates in explicit units.

Parameters
vxthe x-velocity [uvxy]
vythe y-velocity [uvzy]
uvxythe units of vx and vy
vzthe z-velocity [uvz]
uvzthe units of vz
Returns
the velocity

◆ mkAddTrk()

Velocity larcfm::Velocity::mkAddTrk ( double  trk) const

New velocity from existing velocity by adding the given track angle to this vector's track angle. Essentially, this rotates the vector, a positive angle means a clockwise rotation.

Parameters
trktrack angle [rad]
Returns
new velocity

◆ mkGs() [1/2]

Velocity larcfm::Velocity::mkGs ( double  gs_d) const

New velocity from existing velocity, changing only the ground speed

Parameters
gsground speed [m/s]
Returns
new velocity

New velocity from existing velocity, changing only the ground speed

Parameters
gs[m/s]
Returns

◆ mkGs() [2/2]

Velocity larcfm::Velocity::mkGs ( double  gs_d,
std::string  u 
) const

New velocity from existing velocity, changing only the ground speed

Parameters
gsground speed [u]
uunits
Returns
new velocity

New velocity from existing velocity, changing only the ground speed

Parameters
gs[u]
uunit
Returns

◆ mkTrk() [1/2]

Velocity larcfm::Velocity::mkTrk ( double  trk) const

New velocity from existing velocity, changing only the track

Parameters
trktrack angle [rad]
Returns
new velocity

◆ mkTrk() [2/2]

Velocity larcfm::Velocity::mkTrk ( double  trk,
std::string  u 
) const

New velocity from existing velocity, changing only the track

Parameters
trktrack angle [u]
uunits
Returns
new velocity

◆ mkTrkGsVs()

Velocity larcfm::Velocity::mkTrkGsVs ( const double  trk,
const double  gs,
const double  vs 
)
static

New velocity from Track, Ground Speed, and Vertical speed in internal units. Note that this uses trigonometric functions, and may introduce numeric instability.

Parameters
trkthe track angle [internal]
gsthe ground speed [internal]
vsthe vs [internal]
Returns
the velocity

◆ mkVel()

Velocity larcfm::Velocity::mkVel ( const Vect3 p1,
const Vect3 p2,
double  speed 
)
static

Return the velocity along the line from p1 to p2 at the given speed

Parameters
p1first point
p2second point
speedspeed [internal units] (composite 3 dimensional speed, Not ground or vertical speed!)
Returns
the velocity

◆ mkVs() [1/2]

Velocity larcfm::Velocity::mkVs ( double  vs) const

New velocity from existing velocity, changing only the vertical speed

Parameters
vsvertical speed [m/s]
Returns
new velocity

} New velocity from existing velocity, changing only the vertical speed

Parameters
vs[m/s]
Returns

◆ mkVs() [2/2]

Velocity larcfm::Velocity::mkVs ( double  vs,
std::string  u 
) const

New velocity from existing velocity, changing only the vertical speed

Parameters
vsvertical speed [u]
uunits
Returns
new velocity

New velocity from existing velocity, changing only the vertical speed

Parameters
vs[u]
uunits
Returns

◆ mkVxyz()

Velocity larcfm::Velocity::mkVxyz ( const double  vx,
const double  vy,
const double  vz 
)
static

New velocity from Euclidean coordinates in internal units.

Parameters
vxthe x-velocity [internal]
vythe y-velocity [internal]
vzthe z-velocity [internal]
Returns
the velocity

◆ parse()

Velocity larcfm::Velocity::parse ( const std::string &  str)
static

This parses a space or comma-separated string as a Trk/Gs/Vs Velocity (an inverse to the toString method). If three bare values are present, then it is interpreted as degrees/knots/fpm. If there are 3 value/unit pairs then each values is interpreted wrt the appropriate unit. If the string cannot be parsed, an INVALID value is returned.

Parameters
strstring to parse
Returns
velocity

This parses a space or comma-separated string as a Trk/Gs/Vs Velocity (an inverse to the toString method). If three bare values are present, then it is interpreted as degrees/knots/fpm. If there are 3 value/unit pairs then each values is interpreted wrt the appropriate unit. If the string cannot be parsed, an INVALID value is returned.

◆ parseXYZ()

Velocity larcfm::Velocity::parseXYZ ( const std::string &  str)
static

This parses a space or comma-separated string as a XYZ Velocity (an inverse to the toStringXYZ method). If three bare values are present, then it is interpreted as internal units. If there are 3 value/unit pairs then each values is interpreted wrt the appropriate unit. If the string cannot be parsed, an INVALID value is returned.

Parameters
strstring to parse
Returns
Velocity object

◆ toString() [1/2]

std::string larcfm::Velocity::toString ( ) const

String representation of the velocity in polar coordinates (compass angle and groundspeed)

Returns
a string representation

◆ toString() [2/2]

std::string larcfm::Velocity::toString ( int  prec) const

String representation of the velocity in polar coordinates (compass angle and groundspeed) in [deg, knot, fpm]. This method does not output units.

Parameters
precprecision (0-15)
Returns
a string representation

◆ toStringList() [1/2]

std::vector< std::string > larcfm::Velocity::toStringList ( ) const

Return an array of string representing each value of the velocity in the units deg, knot, fpm.

Returns
array of strings

◆ toStringList() [2/2]

std::vector< std::string > larcfm::Velocity::toStringList ( int  precision) const

Return an array of string representing each value of the velocity in the units deg, knot, fpm.

Parameters
precisionthe number of digits to display
Returns
array of strings

◆ toStringNP() [1/3]

std::string larcfm::Velocity::toStringNP ( ) const

String representation, default number of decimal places, without parentheses

Returns
a string representation

◆ toStringNP() [2/3]

std::string larcfm::Velocity::toStringNP ( const std::string &  utrk,
const std::string &  ugs,
const std::string &  uvs,
int  precision 
) const

String representation, with user-specified precision

Parameters
precisionnumber of decimal places (0-15)
utrkunits of track
ugsunits of ground speed
uvsunits of vertical speed
Returns
a string representation

◆ toStringNP() [3/3]

std::string larcfm::Velocity::toStringNP ( int  precision) const

String representation, with user-specified precision

Parameters
precisionnumber of decimal places (0-15)
Returns
a string representation

◆ toStringUnits() [1/2]

std::string larcfm::Velocity::toStringUnits ( ) const

String representation of the velocity in polar coordinates (compass angle and groundspeed)

Returns
a string representation

◆ toStringUnits() [2/2]

std::string larcfm::Velocity::toStringUnits ( const std::string &  trkUnits,
const std::string &  gsUnits,
const std::string &  vsUnits 
) const

String representation (trk,gs,vs) with the given units

Parameters
trkUnitsunits for track
gsUnitsunits for ground speed
vsUnitsunits for vertical speed
Returns
a string representation

◆ toStringXYZ()

std::string larcfm::Velocity::toStringXYZ ( ) const

Euclidean vector representation to arbitrary precision, in [knot,knot,fpm]

Returns
a string representation

◆ toStringXYZList() [1/2]

std::vector< std::string > larcfm::Velocity::toStringXYZList ( ) const

Return an array of string representing each value of the velocity in terms of its Cartesian dimensions in units knot, knot, fpm.

Returns
array of strings

◆ toStringXYZList() [2/2]

std::vector< std::string > larcfm::Velocity::toStringXYZList ( int  precision) const

Return an array of string representing each value of the velocity in terms of its Cartesian dimensions in units knot, knot, fpm.

Parameters
precisionthe number of digits to display
Returns
array of strings

◆ track() [1/2]

double larcfm::Velocity::track ( const std::string &  utrk) const

Track angle in explicit units in the corresponding range [-Math.PI, Math.PI]. Convention is clockwise with respect to north.

Parameters
utrkthe explicit units of track angle
Returns
the track angle [utrk]

◆ track() [2/2]

double larcfm::Velocity::track ( const Vect3 p1,
const Vect3 p2 
)
static

Return the track along the line from p1 to p2 at the given speed

Parameters
p1first point
p2second point
Returns
the track

◆ trk()

double larcfm::Velocity::trk ( ) const

Track angle in radians in the range [-Math.PI, Math.PI]. Convention is clockwise with respect to north.

Returns
the track angle [rad]

◆ trkgs2v()

Vect2 larcfm::Velocity::trkgs2v ( double  trk,
double  gs 
)
static

Return the 2-dimensional Euclidean vector for velocity given the track and ground speed. The track angle is assumed to use the radians from true North-clockwise convention.

Parameters
trktrack
gsground speed
Returns
2-D velocity

◆ trkgs2vx()

double larcfm::Velocity::trkgs2vx ( double  trk,
double  gs 
)
static

Return the x component of velocity given the track and ground speed. The track angle is assumed to use the radians from true North-clockwise convention.

Parameters
trktrack angle
gsground speed
Returns
x component of velocity

◆ trkgs2vy()

double larcfm::Velocity::trkgs2vy ( double  trk,
double  gs 
)
static

Return the y component of velocity given the track and ground speed. The track angle is assumed to use the radians from true North-clockwise convention.

Parameters
trktrack
gsground speed
Returns
y component of velocity

◆ verticalSpeed()

double larcfm::Velocity::verticalSpeed ( const std::string &  uvs) const

Vertical speed in explicit units.

Parameters
uvsthe explicit units of vertical speed
Returns
the vertical speed [uvs]

◆ vs()

double larcfm::Velocity::vs ( ) const

Vertical speed in internal units.

Returns
the vertical speed

◆ zeroSmallVs()

Velocity larcfm::Velocity::zeroSmallVs ( double  threshold) const

If the z component of the velocity vector is smaller than the threshold, return a new vector with this component set to 0. Return the original vector if the vertical speed is greater than the threshold.

Parameters
thresholdlevel of vertical speed below which the vector is altered
Returns
the new velocity

◆ ZEROV()

const Velocity & larcfm::Velocity::ZEROV ( )
static

Return a zero velocity vector


The documentation for this class was generated from the following files: