bug #352:properly cast constants

This commit is contained in:
Igor Krivenko
2011-12-09 23:38:41 +01:00
parent d400a6245e
commit 36457178f9
17 changed files with 40 additions and 40 deletions

View File

@@ -157,13 +157,13 @@ protected:
template<typename Scalar,int AmbiantDim>
inline Scalar AlignedBox<Scalar,AmbiantDim>::squaredExteriorDistance(const VectorType& p) const
{
Scalar dist2 = 0.;
Scalar dist2(0);
Scalar aux;
for (int k=0; k<dim(); ++k)
{
if ((aux = (p[k]-m_min[k]))<0.)
if ((aux = (p[k]-m_min[k]))<Scalar(0))
dist2 += aux*aux;
else if ( (aux = (m_max[k]-p[k]))<0. )
else if ( (aux = (m_max[k]-p[k]))<Scalar(0))
dist2 += aux*aux;
}
return dist2;

View File

@@ -314,9 +314,9 @@ Quaternion<Scalar>::toRotationMatrix(void) const
// it has to be inlined, and so the return by value is not an issue
Matrix3 res;
const Scalar tx = 2*this->x();
const Scalar ty = 2*this->y();
const Scalar tz = 2*this->z();
const Scalar tx = Scalar(2)*this->x();
const Scalar ty = Scalar(2)*this->y();
const Scalar tz = Scalar(2)*this->z();
const Scalar twx = tx*this->w();
const Scalar twy = ty*this->w();
const Scalar twz = tz*this->w();
@@ -327,15 +327,15 @@ Quaternion<Scalar>::toRotationMatrix(void) const
const Scalar tyz = tz*this->y();
const Scalar tzz = tz*this->z();
res.coeffRef(0,0) = 1-(tyy+tzz);
res.coeffRef(0,0) = Scalar(1)-(tyy+tzz);
res.coeffRef(0,1) = txy-twz;
res.coeffRef(0,2) = txz+twy;
res.coeffRef(1,0) = txy+twz;
res.coeffRef(1,1) = 1-(txx+tzz);
res.coeffRef(1,1) = Scalar(1)-(txx+tzz);
res.coeffRef(1,2) = tyz-twx;
res.coeffRef(2,0) = txz-twy;
res.coeffRef(2,1) = tyz+twx;
res.coeffRef(2,2) = 1-(txx+tyy);
res.coeffRef(2,2) = Scalar(1)-(txx+tyy);
return res;
}