cppcheck
This commit is contained in:
@@ -216,7 +216,7 @@ decimate(const std::string &_ifname,
|
||||
using namespace std;
|
||||
|
||||
Mesh mesh;
|
||||
OpenMesh::IO::Options opt;
|
||||
OpenMesh::IO::Options readopt;
|
||||
OpenMesh::Utils::Timer timer;
|
||||
|
||||
// ---------------------------------------- read source mesh
|
||||
@@ -227,7 +227,7 @@ decimate(const std::string &_ifname,
|
||||
|
||||
if (gverbose)
|
||||
clog << _ifname << endl;
|
||||
if ( !(rc = OpenMesh::IO::read_mesh(mesh, _ifname, opt)) )
|
||||
if ( !(rc = OpenMesh::IO::read_mesh(mesh, _ifname, readopt)) )
|
||||
{
|
||||
cerr << " ERROR: read failed!" << endl;
|
||||
return rc;
|
||||
@@ -238,7 +238,7 @@ decimate(const std::string &_ifname,
|
||||
{
|
||||
// ---- 0 - For module NormalFlipping one needs face normals
|
||||
|
||||
if ( !opt.check( OpenMesh::IO::Options::FaceNormal ) )
|
||||
if ( !readopt.check( OpenMesh::IO::Options::FaceNormal ) )
|
||||
{
|
||||
if ( !mesh.has_face_normals() )
|
||||
mesh.request_face_normals();
|
||||
@@ -420,11 +420,11 @@ decimate(const std::string &_ifname,
|
||||
ofname.insert(++pos, n );
|
||||
}
|
||||
|
||||
OpenMesh::IO::Options opt;
|
||||
OpenMesh::IO::Options writeopt;
|
||||
|
||||
//opt += OpenMesh::IO::Options::Binary;
|
||||
|
||||
if ( !OpenMesh::IO::write_mesh(mesh, ofname, opt ) )
|
||||
if ( !OpenMesh::IO::write_mesh(mesh, ofname, writeopt ) )
|
||||
{
|
||||
std::cerr << " Cannot write decimated mesh to file '"
|
||||
<< ofname << "'\n";
|
||||
|
||||
@@ -137,7 +137,7 @@ private:
|
||||
/// coarsen mesh down to _n vertices
|
||||
void coarsen(unsigned int _n);
|
||||
|
||||
virtual void keyPressEvent(QKeyEvent* _event);
|
||||
virtual void keyPressEvent(QKeyEvent* _event) override;
|
||||
|
||||
// mesh data
|
||||
bool animateRefinement_;
|
||||
|
||||
@@ -89,17 +89,17 @@ protected:
|
||||
|
||||
inline static Scalar compute_limit_weight(uint _valence)
|
||||
{
|
||||
double proj_weight = compute_proj_weight(_valence);
|
||||
proj_weight = proj_weight/(proj_weight + _valence);//normalize the proj_weight
|
||||
double weight = (3.0/8.0)/(1.0 - proj_weight + (3.0/8.0));
|
||||
double proj_weight_value = compute_proj_weight(_valence);
|
||||
proj_weight_value = proj_weight_value/(proj_weight_value + _valence);//normalize the proj_weight
|
||||
double weight = (3.0/8.0)/(1.0 - proj_weight_value + (3.0/8.0));
|
||||
return (Scalar)weight;
|
||||
}
|
||||
|
||||
inline static Scalar compute_step_weight(uint _valence)
|
||||
{
|
||||
double proj_weight = compute_proj_weight(_valence);
|
||||
proj_weight = proj_weight/(proj_weight + _valence);//normalize the proj_weight
|
||||
double weight = proj_weight - (3.0/8.0);
|
||||
double proj_weight_value = compute_proj_weight(_valence);
|
||||
proj_weight_value = proj_weight_value/(proj_weight_value + _valence);//normalize the proj_weight
|
||||
double weight = proj_weight_value - (3.0/8.0);
|
||||
return (Scalar)weight;
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ public:
|
||||
{}
|
||||
|
||||
template <class _Point>
|
||||
QuadricT(const _Point& _pt)
|
||||
explicit QuadricT(const _Point& _pt)
|
||||
{
|
||||
set_distance_to_point(_pt);
|
||||
}
|
||||
|
||||
@@ -133,11 +133,13 @@ protected:
|
||||
|
||||
bool check(BaseExporter& _be, Options _opt) const
|
||||
{
|
||||
return (_opt.check(Options::VertexNormal ) <= _be.has_vertex_normals())
|
||||
&& (_opt.check(Options::VertexTexCoord)<= _be.has_vertex_texcoords())
|
||||
&& (_opt.check(Options::VertexColor) <= _be.has_vertex_colors())
|
||||
&& (_opt.check(Options::FaceNormal) <= _be.has_face_normals())
|
||||
&& (_opt.check(Options::FaceColor) <= _be.has_face_colors());
|
||||
// Check for all Options. When we want to write them (_opt.check() ) , they have to be available ( has_ )
|
||||
// Converts to not A (write them) or B (available)
|
||||
return ( !_opt.check(Options::VertexNormal ) || _be.has_vertex_normals())
|
||||
&& ( !_opt.check(Options::VertexTexCoord)|| _be.has_vertex_texcoords())
|
||||
&& ( !_opt.check(Options::VertexColor) || _be.has_vertex_colors())
|
||||
&& ( !_opt.check(Options::FaceNormal) || _be.has_face_normals())
|
||||
&& ( !_opt.check(Options::FaceColor) || _be.has_face_colors());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -100,24 +100,24 @@ write(const std::string& _filename, BaseExporter& _be, Options _opt, std::stream
|
||||
|
||||
{
|
||||
#if defined(WIN32)
|
||||
std::string::size_type dot = _filename.find_last_of("\\/");
|
||||
std::string::size_type dotposition = _filename.find_last_of("\\/");
|
||||
#else
|
||||
std::string::size_type dot = _filename.rfind("/");
|
||||
std::string::size_type dotposition = _filename.rfind("/");
|
||||
#endif
|
||||
|
||||
if (dot == std::string::npos){
|
||||
if (dotposition == std::string::npos){
|
||||
path_ = "./";
|
||||
objName_ = _filename;
|
||||
}else{
|
||||
path_ = _filename.substr(0,dot+1);
|
||||
objName_ = _filename.substr(dot+1);
|
||||
path_ = _filename.substr(0,dotposition+1);
|
||||
objName_ = _filename.substr(dotposition+1);
|
||||
}
|
||||
|
||||
//remove the file extension
|
||||
dot = objName_.find_last_of(".");
|
||||
dotposition = objName_.find_last_of(".");
|
||||
|
||||
if(dot != std::string::npos)
|
||||
objName_ = objName_.substr(0,dot);
|
||||
if(dotposition != std::string::npos)
|
||||
objName_ = objName_.substr(0,dotposition);
|
||||
}
|
||||
|
||||
bool result = write(out, _be, _opt, _precision);
|
||||
|
||||
@@ -40,7 +40,7 @@ bool _VTKWriter_::write(const std::string& _filename, BaseExporter& _be, Options
|
||||
|
||||
bool _VTKWriter_::write(std::ostream& _out, BaseExporter& _be, Options _opt, std::streamsize _precision) const
|
||||
{
|
||||
Vec3f v, n;
|
||||
Vec3f n;
|
||||
Vec2f t;
|
||||
VertexHandle vh;
|
||||
OpenMesh::Vec3f c;
|
||||
@@ -78,7 +78,7 @@ bool _VTKWriter_::write(std::ostream& _out, BaseExporter& _be, Options _opt, std
|
||||
_out << "POINTS " << _be.n_vertices() << " float\n";
|
||||
size_t nv = _be.n_vertices();
|
||||
for (size_t i = 0; i < nv; ++i) {
|
||||
Vec3f v = _be.point(VertexHandle(int(i)));
|
||||
const Vec3f v = _be.point(VertexHandle(int(i)));
|
||||
_out << v[0] << ' ' << v[1] << ' ' << v[2] << '\n';
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ class multiplex_target : public basic_multiplex_target
|
||||
{
|
||||
public:
|
||||
explicit multiplex_target(T& _t) : target_(_t) {}
|
||||
virtual void operator<<(const std::string& _s) { target_ << _s; }
|
||||
virtual void operator<<(const std::string& _s) override { target_ << _s; }
|
||||
private:
|
||||
T& target_;
|
||||
};
|
||||
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
public:
|
||||
|
||||
/// Default constructor
|
||||
PropertyT(const std::string& _name = "<unknown>")
|
||||
explicit PropertyT(const std::string& _name = "<unknown>")
|
||||
: BaseProperty(_name)
|
||||
{}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ public: //-------------------------------------------------------- public types
|
||||
typedef typename ModuleList::iterator ModuleListIterator;
|
||||
|
||||
public: //------------------------------------------------------ public methods
|
||||
BaseDecimaterT(Mesh& _mesh);
|
||||
explicit BaseDecimaterT(Mesh& _mesh);
|
||||
virtual ~BaseDecimaterT();
|
||||
|
||||
/** Initialize decimater and decimating modules.
|
||||
|
||||
@@ -89,7 +89,7 @@ public: //-------------------------------------------------------- public types
|
||||
public: //------------------------------------------------------ public methods
|
||||
|
||||
/// Constructor
|
||||
DecimaterT( Mesh& _mesh );
|
||||
explicit DecimaterT( Mesh& _mesh );
|
||||
|
||||
/// Destructor
|
||||
~DecimaterT();
|
||||
|
||||
@@ -72,7 +72,7 @@ class ModIndependentSetsT: public ModBaseT<MeshT> {
|
||||
;
|
||||
|
||||
/// Constructor
|
||||
ModIndependentSetsT(MeshT &_mesh) :
|
||||
explicit ModIndependentSetsT(MeshT &_mesh) :
|
||||
Base(_mesh, true) {
|
||||
}
|
||||
|
||||
|
||||
@@ -208,9 +208,9 @@ public:
|
||||
// the smaller the factor, the smaller normal_deviation_ gets
|
||||
// thus creating a stricter constraint
|
||||
// division by error_tolerance_factor_ is for normalization
|
||||
Scalar normal_deviation = normal_deviation_ * static_cast<Scalar>( 180.0 / M_PI * _factor / this->error_tolerance_factor_);
|
||||
Scalar normal_deviation_value = normal_deviation_ * static_cast<Scalar>( 180.0 / M_PI * _factor / this->error_tolerance_factor_);
|
||||
|
||||
set_normal_deviation(normal_deviation);
|
||||
set_normal_deviation(normal_deviation_value);
|
||||
this->error_tolerance_factor_ = _factor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
public:
|
||||
|
||||
/// Constructor
|
||||
ModNormalFlippingT( MeshT &_mesh) : Base(_mesh, true)
|
||||
explicit ModNormalFlippingT( MeshT &_mesh) : Base(_mesh, true)
|
||||
{
|
||||
set_max_normal_deviation( 90.0f );
|
||||
const bool mesh_has_normals = _mesh.has_face_normals();
|
||||
@@ -159,8 +159,8 @@ public:
|
||||
// the smaller the factor, the smaller max_deviation_ gets
|
||||
// thus creating a stricter constraint
|
||||
// division by error_tolerance_factor_ is for normalization
|
||||
double max_normal_deviation = (max_deviation_ * 180.0/M_PI) * _factor / this->error_tolerance_factor_;
|
||||
set_max_normal_deviation(max_normal_deviation);
|
||||
double max_normal_deviation_value = (max_deviation_ * 180.0/M_PI) * _factor / this->error_tolerance_factor_;
|
||||
set_max_normal_deviation(max_normal_deviation_value);
|
||||
this->error_tolerance_factor_ = _factor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ class ModRoundnessT : public ModBaseT<MeshT>
|
||||
public:
|
||||
|
||||
/// Constructor
|
||||
ModRoundnessT( MeshT &_dec ) :
|
||||
explicit ModRoundnessT( MeshT &_dec ) :
|
||||
Base(_dec, false),
|
||||
min_r_(-1.0)
|
||||
{ }
|
||||
|
||||
@@ -258,9 +258,9 @@ public:
|
||||
bool check()
|
||||
{
|
||||
bool ok(true);
|
||||
unsigned int i, j;
|
||||
for (i=0; i<size(); ++i)
|
||||
for (unsigned int i=0; i<size(); ++i)
|
||||
{
|
||||
unsigned int j;
|
||||
if (((j=left(i))<size()) && interface_.greater(entry(i), entry(j)))
|
||||
{
|
||||
omerr() << "Heap condition violated\n";
|
||||
|
||||
Reference in New Issue
Block a user