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

#include <Vect3.h>

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

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 Vect3ZERO ()
 
static const Vect3INVALID ()
 
static Vect3 parse (const std::string &s)
 

Public Attributes

double x
 
double y
 
double z
 

Static Private Member Functions

static Vect3 makeInvalid3 ()
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Vect3() [1/2]

larcfm::Vect3::Vect3 ( const double  xx = 0,
const double  yy = 0,
const double  zz = 0 
)

Creates a new vector with coordinates (x,y).

Parameters
xxReal value
yyReal value
zzReal value

◆ Vect3() [2/2]

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.

Parameters
va 2-D Vector
vzthe z component of the new vector

◆ ~Vect3()

virtual larcfm::Vect3::~Vect3 ( )
inlinevirtual

Destructor

Member Function Documentation

◆ Add()

Vect3 larcfm::Vect3::Add ( const Vect3 v) const

Vector addition.

Parameters
vVector
Returns
the vector addition of this vector and v.

◆ AddScal()

Vect3 larcfm::Vect3::AddScal ( double  k,
const Vect3 v 
) const

Addition and scalar multiplication. Compute: this + k*v;

Parameters
kreal value
vvector
Returns
the addition of this vector to v scaled by k.

◆ almostEquals() [1/2]

bool larcfm::Vect3::almostEquals ( const Vect3 v) const

Checks if vectors are almost equal.

Parameters
vVector
Returns
true, if this vector is almost equal to v.

◆ almostEquals() [2/2]

bool larcfm::Vect3::almostEquals ( const Vect3 v,
INT64FM  maxUlps 
) const

Checks if vectors are almost equal.

Parameters
vVector
maxUlpsunit of least precision
Returns
true, if this vector is almost equal to v.

◆ cross()

Vect3 larcfm::Vect3::cross ( const Vect3 v) const

Cross product.

Parameters
vVector
Returns
the cross product of this vector and v.

◆ cyl_norm()

double larcfm::Vect3::cyl_norm ( const double  d,
const double  h 
) const

Cylindrical norm.

Parameters
dRadius of cylinder
hHalf-height of cylinder
Returns
the cylindrical distance of this. The cylindrical distance is 1 when this is at the boundaries of the cylinder.

◆ distanceH()

double larcfm::Vect3::distanceH ( const Vect3 w) const

The horizontal distance between this vector and the given vector, essentially same as v.Sub(w).vect2().norm()

Parameters
wvector
Returns
horizontal distance

◆ distanceV()

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

Parameters
wvector
Returns
vertical distance

◆ dot() [1/2]

double larcfm::Vect3::dot ( const double  x,
const double  y,
const double  z 
) const

Dot product.

Parameters
xReal value
yReal value
zReal value
Returns
the dot product of this vector and (x,y,z).

◆ dot() [2/2]

double larcfm::Vect3::dot ( const Vect3 v) const

Dot product.

Parameters
vVector
Returns
the dot product of this vector and v.

◆ Hat()

Vect3 larcfm::Vect3::Hat ( ) const

Make a unit vector from the current vector. If it is a zero vector, then a copy is returned.

Returns
the unit vector

◆ INVALID()

const Vect3 & larcfm::Vect3::INVALID ( )
static

An invalid vector, used for error reporting

◆ isInvalid()

bool larcfm::Vect3::isInvalid ( ) const

Check if the current vector is valid

Returns
true if the current vector has an "invalid" value

Returns true if the current vector has an "invalid" value

◆ isZero()

bool larcfm::Vect3::isZero ( ) const

Checks if vector is zero.

Returns
true, if this vector is zero.

◆ linear()

Vect3 larcfm::Vect3::linear ( const Vect3 v,
double  t 
) const

Calculates position after t time units in direction and magnitude of velocity v

Parameters
vvelocity
ttime
Returns
the new position

◆ linearByDist2D()

Vect3 larcfm::Vect3::linearByDist2D ( double  track,
double  d 
) const

Calculates position after moving distance d in the direction "track"

Parameters
trackthe direction
ddistance
Returns
the new position (horizontal only)

◆ make()

Vect3 larcfm::Vect3::make ( double  x,
double  y,
double  z 
)
static

Creates a new vector with coordinates (x,y,z) in internal units.

Parameters
xReal value [NM]
yReal value [NM]
zReal value [ft]
Returns
a new vector

◆ makeXYZ()

Vect3 larcfm::Vect3::makeXYZ ( double  x,
std::string  ux,
double  y,
std::string  uy,
double  z,
std::string  uz 
)
static

Creates a new vector with coordinates (x,y,z) in specified units.

Parameters
xReal value [ux]
uxUnits x
yReal value [uy]
uyUnits y
zReal value [uz]
uzUnits z
Returns
a new vector

◆ mk()

Vect3 larcfm::Vect3::mk ( double  x,
double  y,
double  z 
)
static

Creates a new vector with coordinates (x,y,z) in internal units.

Parameters
xReal value [internal units]
yReal value [internal units]
zReal value [internal units]
Returns
a new vector

◆ mkXYZ()

Vect3 larcfm::Vect3::mkXYZ ( double  x,
double  y,
double  z 
)
static

Creates a new vector with coordinates (x,y,z) in internal units.

Parameters
xReal value [internal units]
yReal value [internal units]
zReal value [internal units]
Returns
a new vector

◆ Neg()

Vect3 larcfm::Vect3::Neg ( ) const

Vector negation.

Returns
the vector negation of of this vector.

◆ norm()

double larcfm::Vect3::norm ( ) const

Norm.

Returns
the norm of of this vector.

◆ operator!=()

bool larcfm::Vect3::operator!= ( const Vect3 v) const

Is any component not exactly equal

◆ operator*() [1/2]

Vect3 larcfm::Vect3::operator* ( const double  k) const

Scalar multiplication.

Parameters
kReal value
Returns
the vector scalar multiplication of this vector and k.

◆ operator*() [2/2]

double larcfm::Vect3::operator* ( const Vect3 v) const

Dot product.

Parameters
vVector
Returns
the dot product of this vector and v.

◆ operator+()

Vect3 larcfm::Vect3::operator+ ( const Vect3 v) const

Vector addition.

Parameters
vVector
Returns
the vector addition of this vector and v.

◆ operator-() [1/2]

Vect3 larcfm::Vect3::operator- ( ) const

Vector negation.

Returns
the vector negation of of this vector.

◆ operator-() [2/2]

Vect3 larcfm::Vect3::operator- ( const Vect3 v) const

Vector subtraction.

Parameters
vVector
Returns
the vector subtraction of this vector and v.

◆ operator==()

bool larcfm::Vect3::operator== ( const Vect3 v) const

Exact equality

◆ PerpL()

Vect3 larcfm::Vect3::PerpL ( ) const

Left perpendicular, z-component set to 0

Returns
the left perpendicular of this vector, i.e., (-y, x).

◆ PerpR()

Vect3 larcfm::Vect3::PerpR ( ) const

Right perpendicular, z-component set to 0

Returns
the right perpendicular of this vector, i.e., (y, -x).

◆ Scal()

Vect3 larcfm::Vect3::Scal ( double  k) const

Scalar multiplication.

Parameters
kReal value
Returns
the vector scalar multiplication of this vector and k.

◆ ScalAdd()

Vect3 larcfm::Vect3::ScalAdd ( const double  k,
const Vect3 v 
) const

Scalar and addition multiplication. Compute: k*this + v

Parameters
kReal value
vVector
Returns
the scalar multiplication this vector and k, followed by an addition to vector v.

◆ sqv()

double larcfm::Vect3::sqv ( ) const

Square.

Returns
the dot product of this vector with itself.

◆ Sub()

Vect3 larcfm::Vect3::Sub ( const Vect3 v) const

Vector subtraction.

Parameters
vVector
Returns
the vector subtraction of this vector and v.

◆ tcpa()

double larcfm::Vect3::tcpa ( const Vect3 so,
const Vect3 vo,
const Vect3 si,
const Vect3 vi 
)
static

3-D time of closest point of approach if time is negative or velocities are parallel returns 0

Parameters
soposition of one
vovelocity of one
siposition of two
vivelocity of two
Returns
time of closest point of approach

◆ toString() [1/2]

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

A string representation of this vector

◆ toString() [2/2]

std::string larcfm::Vect3::toString ( int  precision) const

A string representation of this vector

Parameters
precisionnumber of digits of precision
Returns
a string

◆ toStringNP() [1/2]

std::string larcfm::Vect3::toStringNP ( const std::string &  xunit,
const std::string &  yunit,
const std::string &  zunit 
) const

A string representation of this vector

◆ toStringNP() [2/2]

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()

Vect2 larcfm::Vect3::vect2 ( ) const

2-Dimensional projection.

Returns
the 2-dimensional projection of this.

◆ ZERO()

const Vect3 & larcfm::Vect3::ZERO ( )
static

Return a zero vector

Member Data Documentation

◆ x

double larcfm::Vect3::x

x coordinate

◆ y

double larcfm::Vect3::y

y coordinate

◆ z

double larcfm::Vect3::z

z coordinate


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