ICAROUS
|
#include <Vect3.h>
Public Member Functions | |
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 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 Vect3 & | ZERO () |
static const Vect3 & | INVALID () |
static Vect3 | parse (const std::string &s) |
Public Attributes | |
double | x |
double | y |
double | z |
Static Private Member Functions | |
static Vect3 | makeInvalid3 () |
3-Dimensional mathematical vectors. Vect3 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::Vect3::Vect3 | ( | const double | xx = 0 , |
const double | yy = 0 , |
||
const double | zz = 0 |
||
) |
Creates a new vector with coordinates (x
,y
).
xx | Real value |
yy | Real value |
zz | Real value |
larcfm::Vect3::Vect3 | ( | const Vect2 & | v, |
const double | vz | ||
) |
Creates a new vector whose x and y components are v, and whose z component is vz.
v | a 2-D Vector |
vz | the z component of the new vector |
|
inlinevirtual |
Destructor
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::Vect3::almostEquals | ( | const Vect3 & | v | ) | const |
Checks if vectors are almost equal.
v | Vector |
true
, if this
vector is almost equal to v
. bool larcfm::Vect3::almostEquals | ( | const Vect3 & | 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
. Cross product.
v | Vector |
this
vector and v
. double larcfm::Vect3::cyl_norm | ( | const double | d, |
const double | h | ||
) | const |
Cylindrical norm.
d | Radius of cylinder |
h | Half-height of cylinder |
this
. The cylindrical distance is 1 when this
is at the boundaries of the cylinder. double larcfm::Vect3::distanceH | ( | const Vect3 & | w | ) | const |
double larcfm::Vect3::distanceV | ( | const Vect3 & | w | ) | const |
The vertical distance between this vector and the given vector, essentially same as v.z - w.z
w | vector |
double larcfm::Vect3::dot | ( | const double | x, |
const double | y, | ||
const double | z | ||
) | const |
Dot product.
x | Real value |
y | Real value |
z | Real value |
this
vector and (x
,y
,z
). double larcfm::Vect3::dot | ( | const Vect3 & | v | ) | const |
Dot product.
v | Vector |
this
vector and v
. Vect3 larcfm::Vect3::Hat | ( | ) | const |
Make a unit vector from the current vector. If it is a zero vector, then a copy is returned.
|
static |
An invalid vector, used for error reporting
bool larcfm::Vect3::isInvalid | ( | ) | const |
Check if the current vector is valid
Returns true if the current vector has an "invalid" value
bool larcfm::Vect3::isZero | ( | ) | const |
Checks if vector is zero.
true
, if this
vector is zero. Calculates position after t time units in direction and magnitude of velocity v
v | velocity |
t | time |
Vect3 larcfm::Vect3::linearByDist2D | ( | double | track, |
double | d | ||
) | const |
Calculates position after moving distance d in the direction "track"
track | the direction |
d | distance |
|
static |
Creates a new vector with coordinates (x
,y
,z
) in internal units.
x | Real value [NM] |
y | Real value [NM] |
z | Real value [ft] |
|
static |
|
static |
Creates a new vector with coordinates (x
,y
,z
) in internal units.
x | Real value [internal units] |
y | Real value [internal units] |
z | Real value [internal units] |
|
static |
Creates a new vector with coordinates (x
,y
,z
) in internal units.
x | Real value [internal units] |
y | Real value [internal units] |
z | Real value [internal units] |
Vect3 larcfm::Vect3::Neg | ( | ) | const |
Vector negation.
this
vector. double larcfm::Vect3::norm | ( | ) | const |
Norm.
this
vector. bool larcfm::Vect3::operator!= | ( | const Vect3 & | v | ) | const |
Is any component not exactly equal
Vect3 larcfm::Vect3::operator* | ( | const double | k | ) | const |
Scalar multiplication.
k | Real value |
this
vector and k
. double larcfm::Vect3::operator* | ( | const Vect3 & | v | ) | const |
Dot product.
v | Vector |
this
vector and v
. Vector addition.
v | Vector |
this
vector and v
. Vect3 larcfm::Vect3::operator- | ( | ) | const |
Vector negation.
this
vector. Vector subtraction.
v | Vector |
this
vector and v
. bool larcfm::Vect3::operator== | ( | const Vect3 & | v | ) | const |
Exact equality
Vect3 larcfm::Vect3::PerpL | ( | ) | const |
Left perpendicular, z-component set to 0
this
vector, i.e., (-y
, x
). Vect3 larcfm::Vect3::PerpR | ( | ) | const |
Right perpendicular, z-component set to 0
this
vector, i.e., (y
, -x
). Vect3 larcfm::Vect3::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::Vect3::sqv | ( | ) | const |
Square.
this
vector with itself. Vector subtraction.
v | Vector |
this
vector and v
.
|
static |
3-D time of closest point of approach if time is negative or velocities are parallel returns 0
so | position of one |
vo | velocity of one |
si | position of two |
vi | velocity of two |
std::string larcfm::Vect3::toString | ( | ) | const |
A string representation of this vector
std::string larcfm::Vect3::toString | ( | int | precision | ) | const |
A string representation of this vector
precision | number of digits of precision |
std::string larcfm::Vect3::toStringNP | ( | const std::string & | xunit, |
const std::string & | yunit, | ||
const std::string & | zunit | ||
) | const |
A string representation of this vector
std::string larcfm::Vect3::toStringNP | ( | const std::string & | xunit, |
const std::string & | yunit, | ||
const std::string & | zunit, | ||
int | precision | ||
) | const |
A string representation of this vector
Vect2 larcfm::Vect3::vect2 | ( | ) | const |
2-Dimensional projection.
this
.
|
static |
Return a zero vector
double larcfm::Vect3::x |
x coordinate
double larcfm::Vect3::y |
y coordinate
double larcfm::Vect3::z |
z coordinate