11 static inline double my_round(
double val)
13 return floor(val + 0.5);
21 res.
y = v.
y*cos(a) - v.
z*sin(a);
22 res.
z = v.
y*sin(a) + v.
z*cos(a);
29 res.
x = v.
x*cos(a) + v.
z*sin(a);
31 res.
z = -v.
x*sin(a) + v.
z*cos(a);
38 res.
x = v.
x*cos(a) - v.
y*sin(a);
39 res.
y = v.
x*sin(a) + v.
y*cos(a);
46 return sqrt(v.
x*v.
x + v.
y*v.
y + v.
z*v.
z);
53 x(ix),
y(iy),
z(iz) {}
103 return (
abs(
x - v.
x) < EPSILON) && (
abs(
y - v.
y) < EPSILON) && (
abs(
z - v.
z) < EPSILON);
110 v.
y =
y*cos(a) -
z*sin(a);
111 v.
z =
y*sin(a) +
z*cos(a);
119 v.
x =
x*cos(a) +
z*sin(a);
121 v.
z = -
x*sin(a) +
z*cos(a);
129 v.
x =
x*cos(a) -
y*sin(a);
130 v.
y =
x*sin(a) +
y*cos(a);
205 return v - 2 *
ScalarProd(v, normal)*normal / pow(
abs(normal), 2);
215 double x = v1.
y*v2.
z - v1.
z*v2.
y;
216 double y = v1.
z*v2.
x - v1.
x*v2.
z;
217 double z = v1.
x*v2.
y - v1.
y*v2.
x;
222 void Split(vector<Vector3D>
const & vIn, vector<double> & vX, vector<double> & vY, vector<double> & vZ)
224 vX.resize(vIn.size());
225 vY.resize(vIn.size());
226 vZ.resize(vIn.size());
228 for (
size_t ii = 0; ii < vIn.size(); ++ii)
void RotateY(double a)
Rotates the vector around the Y axes.
Vector3D RotateZ(Vector3D const &v, double a)
Rotates a 3D-vector around the Z axis.
Vector3D CrossProduct(Vector3D const &v1, Vector3D const &v2)
Returns the cross product of two vectors.
double z
Component in the z direction.
Vector3D & operator-=(Vector3D const &v)
Subtraction.
Vector3D & operator*=(double s)
Scalar product.
Vector3D RotateX(Vector3D const &v, double a)
Rotates a 3D-vector around the X axis.
Vector3D & operator+=(Vector3D const &v)
Addition.
3D Geometrical calculations
Vector3D Reflect(Vector3D const &v, Vector3D const &normal)
Reflect vector.
double Projection(Vector3D const &v1, Vector3D const &v2)
Calculates the projection of one vector in the direction of the second.
double CalcAngle(Vector3D const &v1, Vector3D const &v2)
Returns the angle between two vectors (in radians)
Vector3D RotateY(Vector3D const &v, double a)
Rotates a 3D-vector around the Y axis.
void RotateX(double a)
Rotates the vector around the X axes.
void Set(double ix, double iy, double iz)
Set vector components.
Vector3D(void)
Null constructor.
Vector3D & operator=(Vector3D const &v)
Assignment operator.
Vector3D operator*(double d, Vector3D const &v)
Scalar product.
double ScalarProd(Vector3D const &v1, Vector3D const &v2)
Scalar product of two vectors.
double y
Component in the y direction.
Vector3D operator/(Vector3D const &v, double d)
Scalar division.
void RotateZ(double a)
Rotates the vector around the Z axes.
void Round()
Integer round of the vector's entries.
void Split(vector< Vector3D > const &vIn, vector< double > &vX, vector< double > &vY, vector< double > &vZ)
Splits a vector of 3D points to components.
double abs(Vector3D const &v)
Norm of a vector.
Vector3D operator+(Vector3D const &v1, Vector3D const &v2)
Term by term addition.
double x
Component in the x direction.
double distance(Vector3D const &v1, Vector3D const &v2)
Calculates the distance between two vectors.
Vector3D operator-(Vector3D const &v1, Vector3D const &v2)
Term by term subtraction.
bool operator==(Vector3D const &v)
Compare 3D-Vectors (up to an arbitrary precision)