Do me a favor, take a few seconds to have a look at my last project.

Thank you, Lulu

Cross product


The cross product of two vectors is a vector which is perpendicular plane containing them. The cross product of vector \(\vec{V}\) and \(\vec{U}\) can be calculated thanks to the following formula:

$$ \vec{V} \times \vec{U} = \left ( \begin{matrix} V_y.U_z - V_z.U_y \\ V_z.U_x - V_x.U_z \\ V_x.U_y - V_y.U_x \end{matrix} \right ) $$


If \(\vec{V}\) and \(\vec{U}\) are collinear, \(\vec{V} \times \vec{U}\) is a null vector.
If \(\vec{V}\) is null, \(\vec{V} \times \vec{U}\) is a null vector.
If \(\vec{U}\) is null, \(\vec{V} \times \vec{U}\) is a null vector.
\(\vec{V} \times \vec{U}\) is normal to the plane containing the vectors \(\vec{V}\) and \(\vec{U}\).
\(\vec{V} \times \vec{U}=-(\vec{U} \times \vec{V}) = (-\vec{U}) \times \vec{V}\).

C++ source code

 * \brief   Compute the cross product of two vectors (this x V)
 *          The current vector is the first operand
 * \param   V is the second operand
 * \return  a vector = the cross product of the current vector by V
inline rOc_vector rOc_vector::cross(const rOc_vector V)
    rOc_vector Res;
    Res.x()=this->y()*V.z() - this->z()*V.y();
    Res.y()=this->z()*V.x() - this->x()*V.z();
    Res.z()=this->x()*V.y() - this->y()*V.x();
    return Res;

See also

Last update : 04/13/2019