mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
Make sure that HyperPlane::transform manitains a unit normal vector in the Affine case.
This commit is contained in:
parent
27ceb43bf6
commit
f5d644b415
@ -217,7 +217,10 @@ public:
|
|||||||
EIGEN_DEVICE_FUNC inline Hyperplane& transform(const MatrixBase<XprType>& mat, TransformTraits traits = Affine)
|
EIGEN_DEVICE_FUNC inline Hyperplane& transform(const MatrixBase<XprType>& mat, TransformTraits traits = Affine)
|
||||||
{
|
{
|
||||||
if (traits==Affine)
|
if (traits==Affine)
|
||||||
|
{
|
||||||
normal() = mat.inverse().transpose() * normal();
|
normal() = mat.inverse().transpose() * normal();
|
||||||
|
m_coeffs /= normal().norm();
|
||||||
|
}
|
||||||
else if (traits==Isometry)
|
else if (traits==Isometry)
|
||||||
normal() = mat * normal();
|
normal() = mat * normal();
|
||||||
else
|
else
|
||||||
|
@ -66,12 +66,15 @@ template<typename HyperplaneType> void hyperplane(const HyperplaneType& _plane)
|
|||||||
VERIFY_IS_MUCH_SMALLER_THAN( pl2.transform(rot,Isometry).absDistance(rot * p1), Scalar(1) );
|
VERIFY_IS_MUCH_SMALLER_THAN( pl2.transform(rot,Isometry).absDistance(rot * p1), Scalar(1) );
|
||||||
pl2 = pl1;
|
pl2 = pl1;
|
||||||
VERIFY_IS_MUCH_SMALLER_THAN( pl2.transform(rot*scaling).absDistance((rot*scaling) * p1), Scalar(1) );
|
VERIFY_IS_MUCH_SMALLER_THAN( pl2.transform(rot*scaling).absDistance((rot*scaling) * p1), Scalar(1) );
|
||||||
|
VERIFY_IS_APPROX( pl2.normal().norm(), RealScalar(1) );
|
||||||
pl2 = pl1;
|
pl2 = pl1;
|
||||||
VERIFY_IS_MUCH_SMALLER_THAN( pl2.transform(rot*scaling*translation)
|
VERIFY_IS_MUCH_SMALLER_THAN( pl2.transform(rot*scaling*translation)
|
||||||
.absDistance((rot*scaling*translation) * p1), Scalar(1) );
|
.absDistance((rot*scaling*translation) * p1), Scalar(1) );
|
||||||
|
VERIFY_IS_APPROX( pl2.normal().norm(), RealScalar(1) );
|
||||||
pl2 = pl1;
|
pl2 = pl1;
|
||||||
VERIFY_IS_MUCH_SMALLER_THAN( pl2.transform(rot*translation,Isometry)
|
VERIFY_IS_MUCH_SMALLER_THAN( pl2.transform(rot*translation,Isometry)
|
||||||
.absDistance((rot*translation) * p1), Scalar(1) );
|
.absDistance((rot*translation) * p1), Scalar(1) );
|
||||||
|
VERIFY_IS_APPROX( pl2.normal().norm(), RealScalar(1) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// casting
|
// casting
|
||||||
|
Loading…
x
Reference in New Issue
Block a user