Classes | Functions
Vector3D.hpp File Reference

3D Geometrical calculations More...

#include <vector>
#include <cmath>
Include dependency graph for Vector3D.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Vector3D
 3D Mathematical vector More...
 

Functions

double abs (Vector3D const &v)
 Norm of a vector. More...
 
Vector3D operator+ (Vector3D const &v1, Vector3D const &v2)
 Term by term addition. More...
 
Vector3D operator- (Vector3D const &v1, Vector3D const &v2)
 Term by term subtraction. More...
 
Vector3D operator* (double d, Vector3D const &v)
 Scalar product. More...
 
Vector3D operator* (Vector3D const &v, double d)
 Scalar product. More...
 
Vector3D operator/ (Vector3D const &v, double d)
 Scalar division. More...
 
double ScalarProd (Vector3D const &v1, Vector3D const &v2)
 Scalar product of two vectors. More...
 
double CalcAngle (Vector3D const &v1, Vector3D const &v2)
 Returns the angle between two vectors (in radians) More...
 
double Projection (Vector3D const &v1, Vector3D const &v2)
 Calculates the projection of one vector in the direction of the second. More...
 
Vector3D RotateX (Vector3D const &v, double a)
 Rotates a 3D-vector around the X axis. More...
 
Vector3D RotateY (Vector3D const &v, double a)
 Rotates a 3D-vector around the Y axis. More...
 
Vector3D RotateZ (Vector3D const &v, double a)
 Rotates a 3D-vector around the Z axis. More...
 
Vector3D Reflect (Vector3D const &v, Vector3D const &normal)
 Reflect vector. More...
 
double distance (Vector3D const &v1, Vector3D const &v2)
 Calculates the distance between two vectors. More...
 
Vector3D CrossProduct (Vector3D const &v1, Vector3D const &v2)
 Returns the cross product of two vectors. More...
 
void Split (vector< Vector3D > const &vIn, vector< double > &vX, vector< double > &vY, vector< double > &vZ)
 Splits a vector of 3D points to components. More...
 

Detailed Description

3D Geometrical calculations

Author
Itai Linial

Definition in file Vector3D.hpp.

Function Documentation

◆ abs()

double abs ( Vector3D const &  v)

Norm of a vector.

Parameters
vThree dimensional vector
Returns
Norm of v

Definition at line 44 of file Vector3D.cpp.

◆ CalcAngle()

double CalcAngle ( Vector3D const &  v1,
Vector3D const &  v2 
)

Returns the angle between two vectors (in radians)

Parameters
v1First vector
v2Second vector
Returns
Angle (radians)

Definition at line 198 of file Vector3D.cpp.

Here is the call graph for this function:

◆ CrossProduct()

Vector3D CrossProduct ( Vector3D const &  v1,
Vector3D const &  v2 
)

Returns the cross product of two vectors.

Parameters
v1First vector
v2Second vector
Returns
Cross product between v1 and v2

Definition at line 213 of file Vector3D.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ distance()

double distance ( Vector3D const &  v1,
Vector3D const &  v2 
)

Calculates the distance between two vectors.

Parameters
v1First vector
v2Second vector
Returns
distance between v1 and v2

Definition at line 208 of file Vector3D.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator*() [1/2]

Vector3D operator* ( double  d,
Vector3D const &  v 
)

Scalar product.

Parameters
dScalar
vVector
Returns
Three dimensional vector

Definition at line 162 of file Vector3D.cpp.

Here is the caller graph for this function:

◆ operator*() [2/2]

Vector3D operator* ( Vector3D const &  v,
double  d 
)

Scalar product.

Parameters
vVector
dScalar
Returns
Three dimensional vector

Definition at line 171 of file Vector3D.cpp.

◆ operator+()

Vector3D operator+ ( Vector3D const &  v1,
Vector3D const &  v2 
)

Term by term addition.

Parameters
v1First vector
v2Second vector
Returns
Sum

Definition at line 143 of file Vector3D.cpp.

Here is the caller graph for this function:

◆ operator-()

Vector3D operator- ( Vector3D const &  v1,
Vector3D const &  v2 
)

Term by term subtraction.

Parameters
v1First vector
v2Second vector
Returns
Difference

Definition at line 152 of file Vector3D.cpp.

Here is the caller graph for this function:

◆ operator/()

Vector3D operator/ ( Vector3D const &  v,
double  d 
)

Scalar division.

Parameters
vVector
dScalar
Returns
Three dimensional vector

Definition at line 176 of file Vector3D.cpp.

Here is the caller graph for this function:

◆ Projection()

double Projection ( Vector3D const &  v1,
Vector3D const &  v2 
)

Calculates the projection of one vector in the direction of the second.

Parameters
v1First vector
v2Direction of the projection
Returns
Component of v1 in the direction of v2

Definition at line 193 of file Vector3D.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Reflect()

Vector3D Reflect ( Vector3D const &  v,
Vector3D const &  normal 
)

Reflect vector.

Parameters
vVector
normalNormal to the reflection plane
Returns
Reflection of v about axis

Definition at line 203 of file Vector3D.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RotateX()

Vector3D RotateX ( Vector3D const &  v,
double  a 
)

Rotates a 3D-vector around the X axis.

Parameters
vVector
a(in radians)
Returns
Rotated vector

Definition at line 17 of file Vector3D.cpp.

Here is the caller graph for this function:

◆ RotateY()

Vector3D RotateY ( Vector3D const &  v,
double  a 
)

Rotates a 3D-vector around the Y axis.

Parameters
vVector
a(in radians)
Returns
Rotated vector

Definition at line 26 of file Vector3D.cpp.

Here is the caller graph for this function:

◆ RotateZ()

Vector3D RotateZ ( Vector3D const &  v,
double  a 
)

Rotates a 3D-vector around the Z axis.

Parameters
vVector
a(in radians)
Returns
Rotated vector

Definition at line 35 of file Vector3D.cpp.

Here is the caller graph for this function:

◆ ScalarProd()

double ScalarProd ( Vector3D const &  v1,
Vector3D const &  v2 
)

Scalar product of two vectors.

Parameters
v13D vector
v23D vector
Returns
Scalar product of v1 and v2

Definition at line 185 of file Vector3D.cpp.

Here is the caller graph for this function:

◆ Split()

void Split ( vector< Vector3D > const &  vIn,
vector< double > &  vX,
vector< double > &  vY,
vector< double > &  vZ 
)

Splits a vector of 3D points to components.

Parameters
vInInput vector of 3D points
vXVector of x coordinates (out)
vYVector of y coordinates (out)
vZVector of z coordinates (out)

Definition at line 222 of file Vector3D.cpp.

Here is the caller graph for this function: