mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
* Add Hyperplane::transform(Matrix/Transform)
* Fix compilations with gcc 3.4, ICC and doxygen * Fix krazy directives (hopefully)
This commit is contained in:
@@ -60,9 +60,11 @@ template<typename _Scalar>
|
||||
class AngleAxis : public RotationBase<AngleAxis<_Scalar>,3>
|
||||
{
|
||||
typedef RotationBase<AngleAxis<_Scalar>,3> Base;
|
||||
using Base::operator*;
|
||||
|
||||
public:
|
||||
|
||||
using Base::operator*;
|
||||
|
||||
enum { Dim = 3 };
|
||||
/** the scalar type of the coefficients */
|
||||
typedef _Scalar Scalar;
|
||||
|
||||
@@ -48,7 +48,7 @@ class ParametrizedLine
|
||||
|
||||
ParametrizedLine(const VectorType& origin, const VectorType& direction)
|
||||
: m_origin(origin), m_direction(direction) {}
|
||||
ParametrizedLine(const Hyperplane<_Scalar, _AmbientDim>& hyperplane);
|
||||
explicit ParametrizedLine(const Hyperplane<_Scalar, _AmbientDim>& hyperplane);
|
||||
|
||||
~ParametrizedLine() {}
|
||||
|
||||
@@ -227,22 +227,41 @@ class Hyperplane
|
||||
invdet*(other.coeffs().coeff(0)*coeffs().coeff(2)-coeffs().coeff(0)*other.coeffs().coeff(2)));
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
template<typename XprType>
|
||||
inline Hyperplane operator* (const MatrixBase<XprType>& mat) const
|
||||
{ return Hyperplane(mat.inverse().transpose() * normal(), offset()); }
|
||||
inline Hyperplane& transform(const MatrixBase<XprType>& mat, TransformTraits traits = GenericAffine)
|
||||
{
|
||||
if (traits==GenericAffine)
|
||||
normal() = mat.inverse().transpose() * normal();
|
||||
else if (traits==NoShear)
|
||||
normal() = (mat.colwise().norm2().cwise().inverse().eval().asDiagonal()
|
||||
* mat.transpose()).transpose() * normal();
|
||||
else if (traits==NoScaling)
|
||||
normal() = mat * normal();
|
||||
else
|
||||
{
|
||||
ei_assert("invalid traits value in Hyperplane::transform()");
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename XprType>
|
||||
inline Hyperplane& operator*= (const MatrixBase<XprType>& mat) const
|
||||
{ normal() = mat.inverse().transpose() * normal(); return *this; }
|
||||
#endif
|
||||
inline Hyperplane& transform(const Transform<Scalar,AmbientDimAtCompileTime>& t,
|
||||
TransformTraits traits = GenericAffine)
|
||||
{
|
||||
transform(t.linear(), traits);
|
||||
offset() -= t.translation().dot(normal());
|
||||
return *this;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
Coefficients m_coeffs;
|
||||
};
|
||||
|
||||
/** Construct a parametrized line from a 2D hyperplane
|
||||
*
|
||||
* \warning the ambient space must have dimension 2 such that the hyperplane actually describes a line
|
||||
*/
|
||||
template <typename _Scalar, int _AmbientDim>
|
||||
ParametrizedLine<_Scalar, _AmbientDim>::ParametrizedLine(const Hyperplane<_Scalar, _AmbientDim>& hyperplane)
|
||||
{
|
||||
|
||||
@@ -61,12 +61,13 @@ template<typename _Scalar>
|
||||
class Quaternion : public RotationBase<Quaternion<_Scalar>,3>
|
||||
{
|
||||
typedef RotationBase<Quaternion<_Scalar>,3> Base;
|
||||
using Base::operator*;
|
||||
typedef Matrix<_Scalar, 4, 1> Coefficients;
|
||||
Coefficients m_coeffs;
|
||||
|
||||
public:
|
||||
|
||||
using Base::operator*;
|
||||
|
||||
/** the scalar type of the coefficients */
|
||||
typedef _Scalar Scalar;
|
||||
|
||||
|
||||
@@ -50,9 +50,11 @@ template<typename _Scalar>
|
||||
class Rotation2D : public RotationBase<Rotation2D<_Scalar>,2>
|
||||
{
|
||||
typedef RotationBase<Rotation2D<_Scalar>,2> Base;
|
||||
using Base::operator*;
|
||||
|
||||
public:
|
||||
|
||||
using Base::operator*;
|
||||
|
||||
enum { Dim = 2 };
|
||||
/** the scalar type of the coefficients */
|
||||
typedef _Scalar Scalar;
|
||||
|
||||
@@ -539,10 +539,11 @@ Transform<Scalar,Dim>::extractRotation(TransformTraits traits) const
|
||||
}
|
||||
else if (traits == NoScaling) // though that's stupid let's handle it !
|
||||
return linear();
|
||||
else {
|
||||
else
|
||||
{
|
||||
ei_assert("invalid traits value in Transform::inverse()");
|
||||
return LinearMatrixType();
|
||||
}
|
||||
return LinearMatrixType();
|
||||
}
|
||||
|
||||
/** Convenient method to set \c *this from a position, orientation and scale
|
||||
|
||||
Reference in New Issue
Block a user