mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-09 06:31:47 +08:00
Fix bug #996: fix comparisons to 0 instead of Scalar(0)
(grafted from e0cff9ae0db1f37d9d463f8af09fd8298a6ccd0d )
This commit is contained in:
parent
b03209a7a6
commit
058fa781d7
@ -637,7 +637,7 @@ inline Quaternion<typename internal::traits<Derived>::Scalar> QuaternionBase<Der
|
|||||||
{
|
{
|
||||||
// FIXME should this function be called multiplicativeInverse and conjugate() be called inverse() or opposite() ??
|
// FIXME should this function be called multiplicativeInverse and conjugate() be called inverse() or opposite() ??
|
||||||
Scalar n2 = this->squaredNorm();
|
Scalar n2 = this->squaredNorm();
|
||||||
if (n2 > 0)
|
if (n2 > Scalar(0))
|
||||||
return Quaternion<Scalar>(conjugate().coeffs() / n2);
|
return Quaternion<Scalar>(conjugate().coeffs() / n2);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -710,7 +710,7 @@ QuaternionBase<Derived>::slerp(const Scalar& t, const QuaternionBase<OtherDerive
|
|||||||
scale0 = sin( ( Scalar(1) - t ) * theta) / sinTheta;
|
scale0 = sin( ( Scalar(1) - t ) * theta) / sinTheta;
|
||||||
scale1 = sin( ( t * theta) ) / sinTheta;
|
scale1 = sin( ( t * theta) ) / sinTheta;
|
||||||
}
|
}
|
||||||
if(d<0) scale1 = -scale1;
|
if(d<Scalar(0)) scale1 = -scale1;
|
||||||
|
|
||||||
return Quaternion<Scalar>(scale0 * coeffs() + scale1 * other.coeffs());
|
return Quaternion<Scalar>(scale0 * coeffs() + scale1 * other.coeffs());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user