Commit 018b6cd5 by Sebastian Eibl

### added Rot3 class and various free functions for vectors

parent 67f9cfca
Pipeline #12146 failed with stage
in 239 minutes and 38 seconds
 ... ... @@ -36,6 +36,7 @@ #include "core/mpi/SendBuffer.h" #include "core/mpi/RecvBuffer.h" #include #include #include ... ... @@ -406,7 +407,8 @@ inline Type Quaternion::operator[]( size_t index ) const template< typename Type > // Data type of the quaternion inline Quaternion& Quaternion::set( Type r, Type i, Type j, Type k ) { WALBERLA_CHECK_FLOAT_EQUAL( std::fabs( r*r + i*i + j*j + k*k ), Type(1), "Invalid quaternion parameters" ); WALBERLA_CHECK_FLOAT_EQUAL( std::fabs( r*r + i*i + j*j + k*k ), Type(1), "Invalid quaternion parameters: " << r << ", "<< i << ", "<< j << ", "<< k ); v_[0] = r; v_[1] = i; v_[2] = j; ... ...
 ... ... @@ -593,6 +593,21 @@ inline Vector3 Vector3::operator%( const Vector3& rhs ) const //********************************************************************************************************************** //********************************************************************************************************************** /*!\brief Cross product (outer product) of two vectors (\f$\vec{a}=\vec{b}\times\vec{c} \f$). // // \param lhs The left-hand-side vector for the cross product. // \param rhs The right-hand-side vector for the cross product. // \return The cross product. */ template< typename Type > inline Vector3 cross( const Vector3& lhs, const Vector3& rhs ) { return lhs % rhs; } //********************************************************************************************************************** //********************************************************************************************************************** /*!\fn Vector3 Vector3::operator+( const Vector3& rhs ) const // \brief Addition operator for the addition of two vectors (\f$\vec{a}=\vec{b}+\vec{c} \f$). ... ... @@ -699,6 +714,13 @@ inline Vector3 Vector3::operator/( Other rhs ) const } //********************************************************************************************************************** template< typename Type, typename Other > inline Vector3 operator/( Other lhs, const Vector3& rhs ) { return Vector3( lhs/rhs[0], lhs/rhs[1], lhs/rhs[2] ); } //********************************************************************************************************************** //====================================================================================================================== // ... ... @@ -1743,6 +1765,41 @@ Vector3 & normalize( Vector3 & v ) } //********************************************************************************************************************** //********************************************************************************************************************** /** // \brief Length of the vector. // // \return Length of the vector. */ template real_t length( const Vector3 & v ) { return v.length(); } //********************************************************************************************************************** //********************************************************************************************************************** /** // \brief Length of the vector squared. // // \return Length of the vector squared. */ template real_t sqrLength( const Vector3 & v ) { return v.sqrLength(); } //********************************************************************************************************************** //********************************************************************************************************************** /** // \brief Dot product of two vectors. */ template real_t dot( const Vector3 & v1, const Vector3 & v2 ) { return v1*v2; } //********************************************************************************************************************** //********************************************************************************************************************** /** ... ...