44 VECTOR_3D(
double xp,
double yp,
double zp ) {
x = xp;
y = yp;
z = zp; };
52 double Len(
void )
const {
return sqrt(
x*
x +
y*
y +
z*
z ); };
54 double LenXY(
void )
const {
return sqrt(
x*
x +
y*
y ); };
56 double LenXZ(
void )
const {
return sqrt(
x*
x +
z*
z ); };
58 double LenYZ(
void )
const {
return sqrt(
y*
y +
z*
z ); };
65 void GetFrom(
double xp,
double yp,
double zp ){
x = xp;
y = yp;
z = zp; };
67 void GetFrom(
double a[] ) {
x = a[0];
y = a[1];
z = a[2];};
70 void PutTo(
double &xp,
double &yp,
double &zp ){ xp =
x; yp =
y; zp =
z; };
72 void PutTo(
double a[] ) { a[0] =
x; a[1] =
y; a[2] =
z;};
75 void AddTo(
double &xp,
double &yp,
double &zp ){ xp +=
x; yp +=
y; zp +=
z; };
77 void AddTo(
double a[] ) { a[0] +=
x; a[1] +=
y; a[2] +=
z;};
80 void Set0(
void ){
x = 0.0;
y = 0.0;
z = 0.0; };
83 bool Isnan(
void ){
return std::isnan(
x ) || std::isnan(
y ) || std::isnan(
z ); };
87 void rotX(
double alpha);
89 void rotY(
double alpha);
91 void rotZ(
double alpha);
93 void rotdX(
double alfa);
95 void rotdY(
double alfa,
double dX = 0. );
97 void rotdZ(
double alfa);
Vector 3D class - vector manipulation.
VECTOR_3D(void)
deafult constructor
void rotX(double alpha)
Rotating functions rotates the vector relative to the X axis by an alpha[rad] angle
double LenXY(void) const
the value of the 2D vector in XY plane
double LenXZ(void) const
the value of the 2D vector in XZ plane
void rotY(double alpha)
rotates the vector relative to the Y axis by an alpha[rad] angle
double LenYZ(void) const
the value of the 2D vector in YZ plane
VECTOR_3D(double a[])
constructor that copies coordiantes from the array
VECTOR_3D & operator=(const VECTOR_3D &v)
assignment operator
double Len(void) const
the value of the vector
bool Isnan(void)
determines if any coordinate of given vector is a not-a-number (NaN) value.
void rotdZ(double alfa)
rotates the vector relative to the Z axis by an alpha[deg] angle (precise values for 0,...
void AddTo(double a[])
adds coordinates to the array
void AddTo(double &xp, double &yp, double &zp)
adds coordinates to three variables
void rotZ(double alpha)
rotates the vector relative to the Z axis by an alpha[rad] angle
void PutTo(double a[])
copies coordinates to the array
void rotdY(double alfa, double dX=0.)
rotates the vector relative to the Y axis (shifted by dX longwise X) by an alpha[deg] angle (precise ...
void PutTo(double &xp, double &yp, double &zp)
copies coordinates to three variables
void Set0(void)
resets coordinates to zero
void GetFrom(double xp, double yp, double zp)
sets coordinates from three variables
void rotdX(double alfa)
rotates the vector relative to the X axis by an alpha[deg] angle (precise values for 0,...
double Normalize(void)
normalizes the vector to unit - coordiantes are divided by the vector value, returnes the vector valu...
double Square(void) const
the square of the vector value
VECTOR_3D(double xp, double yp, double zp)
constructor that copies coordiantes from three variables
void GetFrom(double a[])
sets coordinates from the aray
VECTOR_3D(const VECTOR_3D &v)
constructor that copies coordiantes from another vector
VECTOR_3D operator/(const VECTOR_3D &A, const double &s)
Arithmetic operator - vector divided by scalar (product of vector and reciprocal scalar)
double operator*(const VECTOR_3D &A, const VECTOR_3D &B)
Arithmetic operator - dot (scalar) product of two vectors.
void voutn(FILE *ff, VECTOR_3D vec)
printf vector components (x,-y,z) to stream ff
void operator%=(VECTOR_3D &A, const VECTOR_3D &B)
Arithmetic operator - cross product assigment.
VECTOR_3D operator-(const VECTOR_3D &A, const VECTOR_3D &B)
Arithmetic operator - subtraction of two vectors (sum of A and -B)
VECTOR_3D VECTOR_3__Ex(void)
returns vector (1,0,0)
void operator&=(VECTOR_3D &A, const VECTOR_3D &B)
Arithmetic operator - multiplication assigment (coordiante by coordiante)
void v_printf(char *name, const VECTOR_3D &vec)
print to stdout name and vector components
VECTOR_3D VECTOR_3__Ey(void)
returns vector (0,1,0)
void v_fprintf(FILE *dest, char *name, const VECTOR_3D &vec)
print to stream "dest" name and vector components
void v_sprintf(char *dest, char *name, const VECTOR_3D &vec)
print to string "dest" name and vector components
void operator-=(VECTOR_3D &A, const VECTOR_3D &B)
Arithmetic operator - subtraction assigment.
void operator+=(VECTOR_3D &A, const VECTOR_3D &B)
Arithmetic operator - addition assigment.
void vout0(FILE *ff, VECTOR_3D vec)
printf vector components (x,0,z) to stream ff
VECTOR_3D operator+(const VECTOR_3D &A, const VECTOR_3D &B)
Arithmetic operator - sum of two vectors.
void vout(FILE *ff, VECTOR_3D vec)
printf vector components (x,y,z) to stream ff
std::ostream & operator<<(std::ostream &out, const VECTOR_3D &v)
print to std:ostream
void operator/=(VECTOR_3D &A, const double &s)
Arithmetic operator - division assigment.
VECTOR_3D VECTOR_3__E0(void)
returns vector (0,0,0)
VECTOR_3D operator&(const VECTOR_3D &A, const VECTOR_3D &B)
Arithmetic operator - coordinates products (AxBx, AyBy, AzBz)
VECTOR_3D VECTOR_3__Ez(void)
returns vector (0,0,1)
bool operator==(const VECTOR_3D &A, const VECTOR_3D &B)
Boolean operator - compares two vectors - true if all appropriate coordinates are equal.
VECTOR_3D operator%(const VECTOR_3D &A, const VECTOR_3D &B)
Arithmetic operator - cross (vector) product of two vectors.
VECTOR_3D VECTOR_3__E1(void)
returns vector (1,1,1)
void operator*=(VECTOR_3D &A, const double &s)
Arithmetic operator - multiplication assigment.