|
ICAROUS
|
#include <Vect2.h>
Public Member Functions | |
| Vect2 (const double xx=0.0, const double yy=0.0) | |
| virtual | ~Vect2 () |
| bool | isZero () const |
| bool | almostEquals (const Vect2 &v) const |
| bool | almostEquals (const Vect2 &v, INT64FM maxUlps) const |
| Vect2 | operator+ (const Vect2 &v) const |
| Vect2 | operator- (const Vect2 &v) const |
| Vect2 | operator- () const |
| Vect2 | operator* (const double k) const |
| double | operator* (const Vect2 &v) const |
| bool | operator== (const Vect2 &v) const |
| bool | operator!= (const Vect2 &v) const |
| Vect2 | Hat () const |
| Vect2 | Add (const Vect2 &v) const |
| Vect2 | Sub (const Vect2 &v) const |
| Vect2 | Neg () const |
| Vect2 | Scal (double k) const |
| Vect2 | ScalAdd (const double k, const Vect2 &v) const |
| Vect2 | AddScal (double k, const Vect2 &v) const |
| Vect2 | PerpR () const |
| Vect2 | PerpL () const |
| Vect2 | linear (const Vect2 &v, double t) const |
| double | distance (const Vect2 &s) const |
| double | dot (const double x, const double y) const |
| double | dot (const Vect2 &v) const |
| double | det (const double x, const double y) const |
| double | det (const Vect2 &v) const |
| double | sqv () const |
| double | norm () const |
| double | angle () const |
| double | trk () const |
| double | compassAngle () const |
| double | compassAngle (const Vect2 &v2) const |
| bool | leq (const Vect2 &v, const Vect2 &vo) const |
| bool | isInvalid () 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 | toStringNP (const std::string &xunit, const std::string &yunit, int precision) const |
| std::string | formatXY (const std::string &pre, const std::string &mid, const std::string &post) const |
| std::string | formatXY (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 | within_epsilon (const Vect2 &v2, double epsilon) const |
Static Public Member Functions | |
| static Vect2 | mkTrkGs (double trk, double gs) |
| static double | actual_tcpa (const Vect2 &so, const Vect2 &vo, const Vect2 &si, const Vect2 &vi) |
| static double | tcpa (const Vect2 &so, const Vect2 &vo, const Vect2 &si, const Vect2 &vi) |
| static double | dcpa (const Vect2 &so, const Vect2 &vo, const Vect2 &si, const Vect2 &vi) |
| static double | distPerp (const Vect2 &s, const Vect2 &v, const Vect2 &q) |
| static double | distAlong (const Vect2 &s, const Vect2 &v, const Vect2 &q) |
| static Vect2 | intersect_pt (const Vect2 &s0, const Vect2 &v0, const Vect2 &s1, const Vect2 &v1) |
| static const Vect2 & | ZERO () |
| static const Vect2 & | INVALID () |
Public Attributes | |
| double | x |
| double | y |
Private Member Functions | |
| double | sqRel (const Vect2 &v) const |
2-Dimensional mathematical vectors. Vect2 is immutable. Once these objects are created they can never be changed so multiple references to the same object will never cause problems. However, it does mean that for most vector operations new objects are created. Methods that start with a capital letter create a new object, just as a reminder of this behavior.
| larcfm::Vect2::Vect2 | ( | const double | xx = 0.0, |
| const double | yy = 0.0 |
||
| ) |
Creates a new vector with coordinates (x,y).
| xx | Real value |
| yy | Real value |
|
inlinevirtual |
Destructor
|
static |
Return actual time of closest point approach (return negative infinity if parallel)
Vector addition.
| v | Vector |
this vector and v. Addition and scalar multiplication. Compute: this + k*v;
| k | real value |
| v | vector |
this vector to v scaled by k. | bool larcfm::Vect2::almostEquals | ( | const Vect2 & | v | ) | const |
Checks if vectors are almost equal.
| v | Vector |
true, if this vector is almost equal to v. | bool larcfm::Vect2::almostEquals | ( | const Vect2 & | v, |
| INT64FM | maxUlps | ||
| ) | const |
Checks if vectors are almost equal.
| v | Vector |
| maxUlps | unit of least precision |
true, if this vector is almost equal to v. | double larcfm::Vect2::angle | ( | ) | const |
Angle.
this vector in the range (-pi, pi]. Convention is counter-clockwise with respect to east. | double larcfm::Vect2::compassAngle | ( | ) | const |
Compass angle.
this vector in the range [0, 2*pi). Convention is clockwise with respect to north. | double larcfm::Vect2::compassAngle | ( | const Vect2 & | v2 | ) | const |
Compass angle from this position to v2
| v2 | vector |
v2-this vector in the range [0, 2*Math.PI). Convention is clockwise with respect to north.
|
static |
distance at time of closest point of approach
| so | position of ownship |
| vo | velocity of ownship |
| si | position of intruder |
| vi | velocity of intruder |
Return distance at time of closest point of approach
| double larcfm::Vect2::det | ( | const double | x, |
| const double | y | ||
| ) | const |
Determinant.
| x | Real value |
| y | Real value |
this vector and (x,y). | double larcfm::Vect2::det | ( | const Vect2 & | v | ) | const |
Determinant.
| v | Vector |
this vector and v. returns the longitudinal distance between line defined by s,v and point q.
| s | point on line |
| v | direction vector of line |
| q | a point not on the line |
returns the perpendicular distance between line defined vy s,v and point q.
| s | |
| v | |
| q |
returns the perpendicular distance between line defined by s,v and point q.
| s | point on line |
| v | direction vector of line |
| q | a point not on the line |
returns the perpendicular distance between line defined vy s,v and point q.
| s | |
| v | |
| q |
| double larcfm::Vect2::dot | ( | const double | x, |
| const double | y | ||
| ) | const |
Dot product.
| x | Real value |
| y | Real value |
this vector and (x,y). | double larcfm::Vect2::dot | ( | const Vect2 & | v | ) | const |
Dot product.
| v | Vector |
this vector and v. | Vect2 larcfm::Vect2::Hat | ( | ) | const |
Make a unit vector from the current vector. If it is a zero vector, then a copy is returned.
|
static |
Computes intersection point of two lines
| s0 | starting point of line 1 |
| v0 | direction vector for line 1 |
| s1 | starting point of line 2 |
| v1 | direction vector of line 2 |
|
static |
Return an "invalid" vector
| bool larcfm::Vect2::isInvalid | ( | ) | const |
Returns true if the current vector has an "invalid" value
| bool larcfm::Vect2::isZero | ( | ) | const |
Checks if vector is zero.
true, if this vector is zero. Relative less or equal.
| v | Vector |
| vo | Vector |
true, if the norm of Sub(vo) is less or equal than the norm of v.Sub(vo). Calculates position after t time units in direction and magnitude of velocity v
| v | velocity |
| t | time |
|
static |
Construct a Vect2 from a track angle and ground speed. This is a vector of length gs pointed in the direction of track angle of trk.
| trk | track angle |
| gs | ground speed |
| Vect2 larcfm::Vect2::Neg | ( | ) | const |
Vector negation.
this vector. | double larcfm::Vect2::norm | ( | ) | const |
Norm.
this vector. | bool larcfm::Vect2::operator!= | ( | const Vect2 & | v | ) | const |
Is any component not exactly equal
| Vect2 larcfm::Vect2::operator* | ( | const double | k | ) | const |
Scalar multiplication.
| k | Real value |
this vector and k. | double larcfm::Vect2::operator* | ( | const Vect2 & | v | ) | const |
Dot product.
| v | Vector |
this vector and v. Vector addition.
| v | Vector |
this vector and v. | Vect2 larcfm::Vect2::operator- | ( | ) | const |
Vector negation.
this vector. Vector subtraction.
| v | Vector |
this vector and v. | bool larcfm::Vect2::operator== | ( | const Vect2 & | v | ) | const |
Exact equality
| Vect2 larcfm::Vect2::PerpL | ( | ) | const |
Left perpendicular.
this vector, i.e., (-y, x). | Vect2 larcfm::Vect2::PerpR | ( | ) | const |
Right perpendicular.
this vector, i.e., (y, -x). | Vect2 larcfm::Vect2::Scal | ( | double | k | ) | const |
Scalar multiplication.
| k | Real value |
this vector and k. Scalar and addition multiplication. Compute: k*this + v
| k | real value |
| v | vector |
this vector and k, followed by an addition to vector v. | double larcfm::Vect2::sqv | ( | ) | const |
Square.
this vector with itself. Vector subtraction.
| v | Vector |
this vector and v.
|
static |
time to closest point of approach if time is negative or velocities are parallel returns 0
Return time to closest point approach if time is negative or velocities are parallel returns 0
| std::string larcfm::Vect2::toString | ( | ) | const |
A string representation of this vector
| std::string larcfm::Vect2::toString | ( | int | precision | ) | const |
A string representation of this vector
| precision | number of digits of precision |
| std::string larcfm::Vect2::toStringNP | ( | const std::string & | xunit, |
| const std::string & | yunit | ||
| ) | const |
A string representation of this vector
| double larcfm::Vect2::trk | ( | ) | const |
Track angle.
this vector in the range (-pi, pi]. The track angle is the clockwise angle with respect to north, i.e., v.track() = pi/2 - v.angle(). | bool larcfm::Vect2::within_epsilon | ( | const Vect2 & | v2, |
| double | epsilon | ||
| ) | const |
Returns true if x components and y components of both vectors are within the given bounds
| v2 | vector |
| epsilon | bound |
|
static |
Return a zero vector
| double larcfm::Vect2::x |
The x-component
| double larcfm::Vect2::y |
The y-component