Coverity issues: fix Mesh, Points and Inspection module
This commit is contained in:
@@ -107,9 +107,11 @@ void Approximation::AddPoints(const std::list<Base::Vector3f> &rsPointList)
|
||||
Base::Vector3f Approximation::GetGravity() const
|
||||
{
|
||||
Base::Vector3f clGravity;
|
||||
for (std::list<Base::Vector3f>::const_iterator it = _vPoints.begin(); it!=_vPoints.end(); ++it)
|
||||
clGravity += *it;
|
||||
clGravity *= 1.0f / float(_vPoints.size());
|
||||
if (!_vPoints.empty()) {
|
||||
for (std::list<Base::Vector3f>::const_iterator it = _vPoints.begin(); it!=_vPoints.end(); ++it)
|
||||
clGravity += *it;
|
||||
clGravity *= 1.0f / float(_vPoints.size());
|
||||
}
|
||||
return clGravity;
|
||||
}
|
||||
|
||||
@@ -173,10 +175,10 @@ float PlaneFit::Fit()
|
||||
szz = szz - mz*mz/((double)nSize);
|
||||
|
||||
#if defined(FC_USE_EIGEN)
|
||||
Eigen::Matrix3d covMat = Eigen::Matrix3d::Zero();
|
||||
covMat(0,0) = sxx;
|
||||
covMat(1,1) = syy;
|
||||
covMat(2,2) = szz;
|
||||
Eigen::Matrix3d covMat = Eigen::Matrix3d::Zero();
|
||||
covMat(0,0) = sxx;
|
||||
covMat(1,1) = syy;
|
||||
covMat(2,2) = szz;
|
||||
covMat(0,1) = sxy; covMat(1,0) = sxy;
|
||||
covMat(0,2) = sxz; covMat(2,0) = sxz;
|
||||
covMat(1,2) = syz; covMat(2,1) = syz;
|
||||
@@ -451,7 +453,7 @@ const double& QuadraticFit::GetCoeffArray() const
|
||||
|
||||
double QuadraticFit::GetCoeff(unsigned long ulIndex) const
|
||||
{
|
||||
assert( ulIndex >= 0 && ulIndex < 10 );
|
||||
assert(ulIndex < 10);
|
||||
|
||||
if( _bIsFitted )
|
||||
return _fCoeff[ ulIndex ];
|
||||
@@ -636,9 +638,9 @@ double SurfaceFit::PolynomFit()
|
||||
// <=> sum[(P*Vi)*Vi] = sum[Vi*zi]
|
||||
// <=> sum[(Vi*Vi^t)*P] = sum[Vi*zi] where (Vi*Vi^t) is a symmetric matrix
|
||||
// <=> sum[(Vi*Vi^t)]*P = sum[Vi*zi]
|
||||
Eigen::Matrix<double,6,6> A = Eigen::Matrix<double,6,6>::Zero();
|
||||
Eigen::Matrix<double,6,1> b = Eigen::Matrix<double,6,1>::Zero();
|
||||
Eigen::Matrix<double,6,1> x = Eigen::Matrix<double,6,1>::Zero();
|
||||
Eigen::Matrix<double,6,6> A = Eigen::Matrix<double,6,6>::Zero();
|
||||
Eigen::Matrix<double,6,1> b = Eigen::Matrix<double,6,1>::Zero();
|
||||
Eigen::Matrix<double,6,1> x = Eigen::Matrix<double,6,1>::Zero();
|
||||
|
||||
std::vector<Base::Vector3d> transform;
|
||||
transform.reserve(_vPoints.size());
|
||||
@@ -765,7 +767,8 @@ double SurfaceFit::PolynomFit()
|
||||
// that 'sigma' becomes negative.
|
||||
if (sigma < 0)
|
||||
sigma = 0;
|
||||
sigma = sqrt(sigma/_vPoints.size());
|
||||
if (!_vPoints.empty())
|
||||
sigma = sqrt(sigma/_vPoints.size());
|
||||
|
||||
_fLastResult = static_cast<float>(sigma);
|
||||
return _fLastResult;
|
||||
|
||||
Reference in New Issue
Block a user