VectorT: Implement .cross() and .dot() methods.
Aliases for operators % and | for better compatibility with Eigen3.
This commit is contained in:
@@ -369,7 +369,7 @@ class VectorT {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// cross product: only defined for Vec3* as specialization
|
/// cross product: only defined for Vec3* as specialization
|
||||||
/// \see OpenMesh::cross
|
/// \see OpenMesh::cross and .cross()
|
||||||
template<typename OtherScalar>
|
template<typename OtherScalar>
|
||||||
auto operator% (const VectorT<OtherScalar, DIM> &_rhs) const ->
|
auto operator% (const VectorT<OtherScalar, DIM> &_rhs) const ->
|
||||||
typename std::enable_if<DIM == 3,
|
typename std::enable_if<DIM == 3,
|
||||||
@@ -382,8 +382,18 @@ class VectorT {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// cross product: only defined for Vec3* as specialization
|
||||||
|
/// \see OpenMesh::cross and .operator%
|
||||||
|
template<typename OtherScalar>
|
||||||
|
auto cross (const VectorT<OtherScalar, DIM> &_rhs) const ->
|
||||||
|
decltype(*this % _rhs)
|
||||||
|
{
|
||||||
|
return *this % _rhs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// compute scalar product
|
/// compute scalar product
|
||||||
/// \see OpenMesh::dot
|
/// \see OpenMesh::dot and .dot()
|
||||||
template<typename OtherScalar>
|
template<typename OtherScalar>
|
||||||
auto operator|(const VectorT<OtherScalar, DIM>& _rhs) const ->
|
auto operator|(const VectorT<OtherScalar, DIM>& _rhs) const ->
|
||||||
decltype(*this->data() * *_rhs.data()) {
|
decltype(*this->data() * *_rhs.data()) {
|
||||||
@@ -392,6 +402,15 @@ class VectorT {
|
|||||||
*begin() * *_rhs.begin());
|
*begin() * *_rhs.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// compute scalar product
|
||||||
|
/// \see OpenMesh::dot and .operator|
|
||||||
|
template<typename OtherScalar>
|
||||||
|
auto dot(const VectorT<OtherScalar, DIM>& _rhs) const ->
|
||||||
|
decltype(*this | _rhs)
|
||||||
|
{
|
||||||
|
return *this | _rhs;
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------ euclidean norm
|
//------------------------------------------------------------ euclidean norm
|
||||||
|
|
||||||
/// \name Euclidean norm calculations
|
/// \name Euclidean norm calculations
|
||||||
|
|||||||
Reference in New Issue
Block a user