Merge branch 'cppcheck' into 'master'

Cppcheck Fixes

See merge request OpenMesh/OpenMesh!337
This commit is contained in:
Jan Möbius
2023-08-23 15:15:11 +00:00
53 changed files with 245 additions and 253 deletions

View File

@@ -1,4 +1,4 @@
!/bin/bash
#/bin/bash
# Exit script on any error
set -e
@@ -32,7 +32,7 @@ echo "CPPCHECK Summary"
echo "=============================================================================="
echo -e "${NC}"
MAX_COUNT=720
MAX_COUNT=171
if [ $COUNT -gt $MAX_COUNT ]; then
echo -e ${WARNING}

View File

@@ -84,13 +84,13 @@
using namespace OpenMesh;
struct MyTraits : public DEFAULT_TRAITS
struct MyDecimaterViewerWidgetTraits : public DEFAULT_TRAITS
{
VertexAttributes ( Attributes::Normal );
FaceAttributes ( Attributes::Normal );
};
typedef TRIMESH_KERNEL<MyTraits> mesh_t;
typedef TRIMESH_KERNEL<MyDecimaterViewerWidgetTraits> mesh_t;
typedef MeshViewerWidgetT<mesh_t> MeshViewerWidgetDecimaterBase;
//== CLASS DEFINITION =========================================================

View File

@@ -489,15 +489,11 @@ int main(int argc, char* argv[])
std::clog << " Input file: " << ifname << std::endl;
std::clog << " Output file: " << ofname << std::endl;
std::clog << " #collapses: " << opt.n_collapses << std::endl;
}
//----------------------------------------
//----------------------------------------
if (gverbose)
{
std::clog << "Begin decimation" << std::endl;
}
@@ -512,6 +508,7 @@ int main(int argc, char* argv[])
}
//----------------------------------------
return 0;
}

View File

@@ -96,6 +96,7 @@ public:
/// default constructor
explicit ProgViewerWidget(QWidget* _parent=0)
: MeshViewerWidgetProgBase(_parent),
animateRefinement_(true),
n_base_vertices_(0),
n_base_faces_(0),
n_detail_vertices_(0),

View File

@@ -54,7 +54,7 @@ using namespace OpenMesh;
using namespace Smoother;
struct MyTraits : public OpenMesh::DefaultTraits
struct MySmoothingTraits : public OpenMesh::DefaultTraits
{
#if 1
typedef OpenMesh::Vec3f Point;
@@ -65,7 +65,7 @@ struct MyTraits : public OpenMesh::DefaultTraits
#endif
};
typedef OpenMesh::TriMesh_ArrayKernelT<MyTraits> MyMesh;
typedef OpenMesh::TriMesh_ArrayKernelT<MySmoothingTraits> MyMesh;
//-----------------------------------------------------------------------------

View File

@@ -88,7 +88,7 @@ public:
public:
/// constructor
SubdivideWidget(QWidget* _parent=0, const char* _name=0);
explicit SubdivideWidget(QWidget* _parent=0, const char* _name=0);
/// destructor
~SubdivideWidget() {};

View File

@@ -229,7 +229,10 @@ replace_extension( std::string& _s, const std::string& _e )
if (dot == std::string::npos)
{ _s += "." + _e; }
else
{ _s = _s.substr(0,dot+1)+_e; }
{
const std::string temp_name = _s.substr(0,dot+1);
_s = temp_name + _e;
}
return _s;
}

View File

@@ -407,7 +407,7 @@ open_vd_prog_mesh(const char* _filename)
}
//
bool swap = Endian::local() != Endian::LSB;
bool swap_required = Endian::local() != Endian::LSB;
// read header
ifs.read(fileformat, 10); fileformat[10] = '\0';
@@ -418,9 +418,9 @@ open_vd_prog_mesh(const char* _filename)
exit(1);
}
IO::restore(ifs, n_base_vertices_, swap);
IO::restore(ifs, n_base_faces_, swap);
IO::restore(ifs, n_details_, swap);
IO::restore(ifs, n_base_vertices_, swap_required);
IO::restore(ifs, n_base_faces_, swap_required);
IO::restore(ifs, n_details_, swap_required);
mesh_.clear();
vfront_.clear();
@@ -431,12 +431,12 @@ open_vd_prog_mesh(const char* _filename)
// load base mesh
for (i=0; i<n_base_vertices_; ++i)
{
IO::restore(ifs, p, swap);
IO::restore(ifs, radius, swap);
IO::restore(ifs, normal, swap);
IO::restore(ifs, sin_square, swap);
IO::restore(ifs, mue_square, swap);
IO::restore(ifs, sigma_square, swap);
IO::restore(ifs, p, swap_required);
IO::restore(ifs, radius, swap_required);
IO::restore(ifs, normal, swap_required);
IO::restore(ifs, sin_square, swap_required);
IO::restore(ifs, mue_square, swap_required);
IO::restore(ifs, sigma_square, swap_required);
vertex_handle = mesh_.add_vertex(p);
node_index = vhierarchy_.generate_node_index(i, 1);
@@ -462,9 +462,9 @@ open_vd_prog_mesh(const char* _filename)
for (i=0; i<n_base_faces_; ++i)
{
IO::restore(ifs, fvi[0], swap);
IO::restore(ifs, fvi[1], swap);
IO::restore(ifs, fvi[2], swap);
IO::restore(ifs, fvi[0], swap_required);
IO::restore(ifs, fvi[1], swap_required);
IO::restore(ifs, fvi[2], swap_required);
mesh_.add_face(mesh_.vertex_handle(fvi[0]),
mesh_.vertex_handle(fvi[1]),
@@ -475,16 +475,16 @@ open_vd_prog_mesh(const char* _filename)
for (i=0; i<n_details_; ++i)
{
// position of v0
IO::restore(ifs, p, swap);
IO::restore(ifs, p, swap_required);
// vsplit info.
IO::restore(ifs, value, swap);
IO::restore(ifs, value, swap_required);
node_index = VHierarchyNodeIndex(value);
IO::restore(ifs, value, swap);
IO::restore(ifs, value, swap_required);
fund_lcut_index = VHierarchyNodeIndex(value);
IO::restore(ifs, value, swap);
IO::restore(ifs, value, swap_required);
fund_rcut_index = VHierarchyNodeIndex(value);
@@ -506,22 +506,22 @@ open_vd_prog_mesh(const char* _filename)
index2handle_map[rchild.node_index()] = node.rchild_handle();
// view-dependent parameters
IO::restore(ifs, radius, swap);
IO::restore(ifs, normal, swap);
IO::restore(ifs, sin_square, swap);
IO::restore(ifs, mue_square, swap);
IO::restore(ifs, sigma_square, swap);
IO::restore(ifs, radius, swap_required);
IO::restore(ifs, normal, swap_required);
IO::restore(ifs, sin_square, swap_required);
IO::restore(ifs, mue_square, swap_required);
IO::restore(ifs, sigma_square, swap_required);
lchild.set_radius(radius);
lchild.set_normal(normal);
lchild.set_sin_square(sin_square);
lchild.set_mue_square(mue_square);
lchild.set_sigma_square(sigma_square);
IO::restore(ifs, radius, swap);
IO::restore(ifs, normal, swap);
IO::restore(ifs, sin_square, swap);
IO::restore(ifs, mue_square, swap);
IO::restore(ifs, sigma_square, swap);
IO::restore(ifs, radius, swap_required);
IO::restore(ifs, normal, swap_required);
IO::restore(ifs, sin_square, swap_required);
IO::restore(ifs, mue_square, swap_required);
IO::restore(ifs, sigma_square, swap_required);
rchild.set_radius(radius);
rchild.set_normal(normal);
rchild.set_sin_square(sin_square);

View File

@@ -106,7 +106,7 @@ public:
public:
VDPMSynthesizerViewerWidget(QWidget* _parent=0, const char* _name=0);
explicit VDPMSynthesizerViewerWidget(QWidget* _parent=0, const char* _name=0);
~VDPMSynthesizerViewerWidget();
@@ -144,12 +144,12 @@ private:
void update_viewing_parameters();
virtual void keyPressEvent(QKeyEvent* _event);
virtual void keyPressEvent(QKeyEvent* _event) override;
protected:
/// inherited drawing method
virtual void draw_scene(const std::string& _draw_mode);
virtual void draw_scene(const std::string& _draw_mode) override;
public:

View File

@@ -154,9 +154,6 @@ public:
private:
/// hide this method
void set_binary(bool _b) {}
OpenMesh::VPropHandleT<level_t> level_;
level_t max_level_; // maximum level reached
@@ -181,9 +178,18 @@ replace_extension( std::string& _s, const std::string& _e )
{
std::string::size_type dot = _s.rfind(".");
if (dot == std::string::npos)
{ _s += "." + _e; }
{
// The name does not include a dot and therefore no extension. Adding both.
_s += "." + _e;
}
else
{ _s = _s.substr(0,dot+1)+_e; }
{
// get everything of the name including the dot but remove the extension.
const std::string name = _s.substr(0,dot+1);
// Add the new extenion
_s = name + _e;
}
return _s;
}

View File

@@ -53,7 +53,7 @@
#include <OpenMesh/Tools/Utils/getopt.h>
struct MyTraits : public OpenMesh::DefaultTraits
struct MyMConvertTraits : public OpenMesh::DefaultTraits
{
VertexAttributes ( OpenMesh::Attributes::Normal |
OpenMesh::Attributes::Color |
@@ -64,7 +64,7 @@ struct MyTraits : public OpenMesh::DefaultTraits
};
typedef OpenMesh::TriMesh_ArrayKernelT<MyTraits> MyMesh;
typedef OpenMesh::TriMesh_ArrayKernelT<MyMConvertTraits> MyMesh;
void usage_and_exit(int xcode)
{

View File

@@ -170,8 +170,9 @@ class VectorT {
}
/// construct from an array
explicit VectorT(container&& _array) {
values_ = _array;
explicit VectorT(container&& _array) :
values_(_array)
{
}
/// copy & cast constructor (explicit)

View File

@@ -74,7 +74,7 @@ namespace IO {
short int read_short(FILE* _in, bool _swap)
{
union u1 { short int s; unsigned char c[2]; } sc;
fread((char*)sc.c, 1, 2, _in);
fread(reinterpret_cast<char*>(sc.c), 1, 2, _in);
if (_swap) std::swap(sc.c[0], sc.c[1]);
return sc.s;
}
@@ -86,7 +86,7 @@ short int read_short(FILE* _in, bool _swap)
int read_int(FILE* _in, bool _swap)
{
union u2 { int i; unsigned char c[4]; } ic;
fread((char*)ic.c, 1, 4, _in);
fread(reinterpret_cast<char*>(ic.c), 1, 4, _in);
if (_swap) {
std::swap(ic.c[0], ic.c[3]);
std::swap(ic.c[1], ic.c[2]);
@@ -101,7 +101,7 @@ int read_int(FILE* _in, bool _swap)
float read_float(FILE* _in, bool _swap)
{
union u3 { float f; unsigned char c[4]; } fc;
fread((char*)fc.c, 1, 4, _in);
fread(reinterpret_cast<char*>(fc.c), 1, 4, _in);
if (_swap) {
std::swap(fc.c[0], fc.c[3]);
std::swap(fc.c[1], fc.c[2]);
@@ -116,7 +116,7 @@ float read_float(FILE* _in, bool _swap)
double read_double(FILE* _in, bool _swap)
{
union u4 { double d; unsigned char c[8]; } dc;
fread((char*)dc.c, 1, 8, _in);
fread(reinterpret_cast<char*>(dc.c), 1, 8, _in);
if (_swap) {
std::swap(dc.c[0], dc.c[7]);
std::swap(dc.c[1], dc.c[6]);
@@ -131,7 +131,7 @@ double read_double(FILE* _in, bool _swap)
short int read_short(std::istream& _in, bool _swap)
{
union u1 { short int s; unsigned char c[2]; } sc;
_in.read((char*)sc.c, 2);
_in.read(reinterpret_cast<char*>(sc.c), 2);
if (_swap) std::swap(sc.c[0], sc.c[1]);
return sc.s;
}
@@ -143,7 +143,7 @@ short int read_short(std::istream& _in, bool _swap)
int read_int(std::istream& _in, bool _swap)
{
union u2 { int i; unsigned char c[4]; } ic;
_in.read((char*)ic.c, 4);
_in.read(reinterpret_cast<char*>(ic.c), 4);
if (_swap) {
std::swap(ic.c[0], ic.c[3]);
std::swap(ic.c[1], ic.c[2]);
@@ -158,7 +158,7 @@ int read_int(std::istream& _in, bool _swap)
float read_float(std::istream& _in, bool _swap)
{
union u3 { float f; unsigned char c[4]; } fc;
_in.read((char*)fc.c, 4);
_in.read(reinterpret_cast<char*>(fc.c), 4);
if (_swap) {
std::swap(fc.c[0], fc.c[3]);
std::swap(fc.c[1], fc.c[2]);
@@ -173,7 +173,7 @@ float read_float(std::istream& _in, bool _swap)
double read_double(std::istream& _in, bool _swap)
{
union u4 { double d; unsigned char c[8]; } dc;
_in.read((char*)dc.c, 8);
_in.read(reinterpret_cast<char*>(dc.c), 8);
if (_swap) {
std::swap(dc.c[0], dc.c[7]);
std::swap(dc.c[1], dc.c[6]);
@@ -192,7 +192,7 @@ void write_short(short int _i, FILE* _out, bool _swap)
union u1 { short int s; unsigned char c[2]; } sc;
sc.s = _i;
if (_swap) std::swap(sc.c[0], sc.c[1]);
fwrite((char*)sc.c, 1, 2, _out);
fwrite(reinterpret_cast<char*>(sc.c), 1, 2, _out);
}
@@ -207,7 +207,7 @@ void write_int(int _i, FILE* _out, bool _swap)
std::swap(ic.c[0], ic.c[3]);
std::swap(ic.c[1], ic.c[2]);
}
fwrite((char*)ic.c, 1, 4, _out);
fwrite(reinterpret_cast<char*>(ic.c), 1, 4, _out);
}
@@ -222,7 +222,7 @@ void write_float(float _f, FILE* _out, bool _swap)
std::swap(fc.c[0], fc.c[3]);
std::swap(fc.c[1], fc.c[2]);
}
fwrite((char*)fc.c, 1, 4, _out);
fwrite(reinterpret_cast<char*>(fc.c), 1, 4, _out);
}
@@ -239,7 +239,7 @@ void write_double(double _d, FILE* _out, bool _swap)
std::swap(dc.c[2], dc.c[5]);
std::swap(dc.c[3], dc.c[4]);
}
fwrite((char*)dc.c, 1, 8, _out);
fwrite(reinterpret_cast<char*>(dc.c), 1, 8, _out);
}
@@ -251,7 +251,7 @@ void write_short(short int _i, std::ostream& _out, bool _swap)
union u1 { short int s; unsigned char c[2]; } sc;
sc.s = _i;
if (_swap) std::swap(sc.c[0], sc.c[1]);
_out.write((char*)sc.c, 2);
_out.write(reinterpret_cast<char*>(sc.c), 2);
}
@@ -266,7 +266,7 @@ void write_int(int _i, std::ostream& _out, bool _swap)
std::swap(ic.c[0], ic.c[3]);
std::swap(ic.c[1], ic.c[2]);
}
_out.write((char*)ic.c, 4);
_out.write(reinterpret_cast<char*>(ic.c), 4);
}
@@ -281,7 +281,7 @@ void write_float(float _f, std::ostream& _out, bool _swap)
std::swap(fc.c[0], fc.c[3]);
std::swap(fc.c[1], fc.c[2]);
}
_out.write((char*)fc.c, 4);
_out.write(reinterpret_cast<char*>(fc.c), 4);
}
@@ -298,7 +298,7 @@ void write_double(double _d, std::ostream& _out, bool _swap)
std::swap(dc.c[2], dc.c[5]);
std::swap(dc.c[3], dc.c[4]);
}
_out.write((char*)dc.c, 8);
_out.write(reinterpret_cast<char*>(dc.c), 8);
}

View File

@@ -141,8 +141,8 @@ namespace OMFormat {
size_t restore( std::istream& _is, bool _swap )
{
if (_is.read( (char*)this, 4 ).eof())
return 0;
if (_is.read( reinterpret_cast<char*>(this) , 4 ).eof())
return 0;
size_t bytes = 4;
bytes += binary<uint32_t>::restore( _is, n_vertices_, _swap );
@@ -307,7 +307,7 @@ namespace OMFormat {
/// Return the size of chunk data in bytes
inline size_t chunk_data_size( Header& _hdr, Chunk::Header& _chunk_hdr )
inline size_t chunk_data_size( const Header& _hdr, const Chunk::Header& _chunk_hdr )
{
size_t C;
switch( _chunk_hdr.entity_ )
@@ -327,7 +327,7 @@ namespace OMFormat {
return C * vector_size( _chunk_hdr );
}
inline size_t chunk_size( Header& _hdr, Chunk::Header& _chunk_hdr )
inline size_t chunk_size( const Header& _hdr, const Chunk::Header& _chunk_hdr )
{
return chunk_header_size() + chunk_data_size( _hdr, _chunk_hdr );
}

View File

@@ -80,11 +80,6 @@ namespace IO {
//-----------------------------------------------------------------------------
// struct binary, helper for storing/restoring
#define X \
std::ostringstream msg; \
msg << "Type not supported: " << typeid(value_type).name(); \
throw std::logic_error(msg.str())
/// \struct binary SR_binary.hh <OpenMesh/Core/IO/SR_binary.hh>
///
/// The struct defines how to store and restore the type T.
@@ -119,7 +114,11 @@ template < typename T, typename = void > struct binary
const value_type& /* _v */,
bool /* _swap */ = false ,
bool /* store_size */ = true ) // for vectors
{ X; return 0; }
{
std::ostringstream msg;
msg << "Type not supported: " << typeid(value_type).name();
throw std::logic_error(msg.str());
}
/// Restore a value of T and return the number of bytes read
static
@@ -127,7 +126,11 @@ template < typename T, typename = void > struct binary
value_type& /* _v */,
bool /* _swap */ = false ,
bool /* store_size */ = true ) // for vectors
{ X; return 0; }
{
std::ostringstream msg;
msg << "Type not supported: " << typeid(value_type).name();
throw std::logic_error(msg.str());
}
};
#undef X

View File

@@ -190,20 +190,20 @@ SIMPLE_BINARY(unsigned long);
static size_t store( std::ostream& _os, const value_type& _val, \
bool _swap=false) { \
value_type tmp = _val; \
size_t i, b = size_of(_val), N = value_type::size_; \
size_t b = size_of(_val), N = value_type::size_; \
if (_swap) \
for (i=0; i<N; ++i) \
for (size_t i=0; i<N; ++i) \
reverse_byte_order( tmp[i] ); \
_os.write( (const char*)&tmp[0], b ); \
return _os.good() ? b : 0; \
} \
\
static size_t restore( std::istream& _is, value_type& _val, \
bool _swap=false) { \
size_t i, N=value_type::size_; \
bool _swap=false) { \
size_t N=value_type::size_; \
size_t b = N * sizeof(value_type::value_type); \
_is.read( (char*)&_val[0], b ); \
if (_swap) for (i=0; i<N; ++i) \
if (_swap) for (size_t i=0; i<N; ++i) \
reverse_byte_order( _val[i] ); \
return _is.good() ? b : 0; \
} \

View File

@@ -121,14 +121,12 @@ public:
VHandles::const_iterator it, it2, end(_indices.end());
// test for valid vertex indices
for (it=_indices.begin(); it!=end; ++it)
if (! mesh_.is_valid_handle(*it))
{
// Test if all vertex handles are valid. If not, we throw an error.
if ( std::any_of(_indices.begin(),_indices.end(),[this](const VertexHandle& vh){ return !mesh_.is_valid_handle(vh); } ) )
{
omerr() << "ImporterT: Face contains invalid vertex index\n";
return fh;
}
}
// don't allow double vertices
for (it=_indices.begin(); it!=end; ++it)

View File

@@ -140,8 +140,7 @@ _OFFReader_::read(std::istream& _in, BaseImporter& _bi, Options& _opt )
}
// filter relevant options for reading
bool swap = _opt.check( Options::Swap );
bool swap_required = _opt.check( Options::Swap );
userOptions_ = _opt;
@@ -159,7 +158,7 @@ _OFFReader_::read(std::istream& _in, BaseImporter& _bi, Options& _opt )
options_ += Options::ColorAlpha;
return (options_.is_binary() ?
read_binary(_in, _bi, _opt, swap) :
read_binary(_in, _bi, _opt, swap_required) :
read_ascii(_in, _bi, _opt));
}

View File

@@ -166,12 +166,12 @@ bool _OMReader_::read_ascii(std::istream& /* _is */, BaseImporter& /* _bi */, Op
bool _OMReader_::read_binary(std::istream& _is, BaseImporter& _bi, Options& _opt) const
{
bool swap = _opt.check(Options::Swap) || (Endian::local() == Endian::MSB);
bool swap_required = _opt.check(Options::Swap) || (Endian::local() == Endian::MSB);
// Initialize byte counter
bytes_ = 0;
bytes_ += restore(_is, header_, swap);
bytes_ += restore(_is, header_, swap_required);
if (header_.version_ > _OMWriter_::get_version())
@@ -183,7 +183,7 @@ bool _OMReader_::read_binary(std::istream& _is, BaseImporter& _bi, Options& _opt
}
while (!_is.eof()) {
bytes_ += restore(_is, chunk_header_, swap);
bytes_ += restore(_is, chunk_header_, swap_required);
if (_is.eof())
break;
@@ -191,30 +191,30 @@ bool _OMReader_::read_binary(std::istream& _is, BaseImporter& _bi, Options& _opt
// Is this a named property restore the name
if (chunk_header_.name_) {
OMFormat::Chunk::PropertyName pn;
bytes_ += restore(_is, property_name_, swap);
bytes_ += restore(_is, property_name_, swap_required);
}
// Read in the property data. If it is an anonymous or unknown named
// property, then skip data.
switch (chunk_header_.entity_) {
case OMFormat::Chunk::Entity_Vertex:
if (!read_binary_vertex_chunk(_is, _bi, _opt, swap))
if (!read_binary_vertex_chunk(_is, _bi, _opt, swap_required))
return false;
break;
case OMFormat::Chunk::Entity_Face:
if (!read_binary_face_chunk(_is, _bi, _opt, swap))
if (!read_binary_face_chunk(_is, _bi, _opt, swap_required))
return false;
break;
case OMFormat::Chunk::Entity_Edge:
if (!read_binary_edge_chunk(_is, _bi, _opt, swap))
if (!read_binary_edge_chunk(_is, _bi, _opt, swap_required))
return false;
break;
case OMFormat::Chunk::Entity_Halfedge:
if (!read_binary_halfedge_chunk(_is, _bi, _opt, swap))
if (!read_binary_halfedge_chunk(_is, _bi, _opt, swap_required))
return false;
break;
case OMFormat::Chunk::Entity_Mesh:
if (!read_binary_mesh_chunk(_is, _bi, _opt, swap))
if (!read_binary_mesh_chunk(_is, _bi, _opt, swap_required))
return false;
break;
case OMFormat::Chunk::Entity_Sentinel:
@@ -291,7 +291,7 @@ bool _OMReader_::supports(const OMFormat::uint8 /* version */) const
//-----------------------------------------------------------------------------
bool _OMReader_::read_binary_vertex_chunk(std::istream &_is, BaseImporter &_bi, Options &_opt, bool _swap) const
bool _OMReader_::read_binary_vertex_chunk(std::istream &_is, BaseImporter &_bi, const Options &_opt, bool _swap) const
{
using OMFormat::Chunk;
@@ -447,7 +447,7 @@ bool _OMReader_::read_binary_vertex_chunk(std::istream &_is, BaseImporter &_bi,
//-----------------------------------------------------------------------------
bool _OMReader_::read_binary_face_chunk(std::istream &_is, BaseImporter &_bi, Options &_opt, bool _swap) const
bool _OMReader_::read_binary_face_chunk(std::istream &_is, BaseImporter &_bi, const Options &_opt, bool _swap) const
{
using OMFormat::Chunk;
@@ -589,7 +589,7 @@ bool _OMReader_::read_binary_face_chunk(std::istream &_is, BaseImporter &_bi, Op
//-----------------------------------------------------------------------------
bool _OMReader_::read_binary_edge_chunk(std::istream &_is, BaseImporter &_bi, Options &_opt, bool _swap) const
bool _OMReader_::read_binary_edge_chunk(std::istream &_is, BaseImporter &_bi, const Options &_opt, bool _swap) const
{
using OMFormat::Chunk;
@@ -641,7 +641,7 @@ bool _OMReader_::read_binary_edge_chunk(std::istream &_is, BaseImporter &_bi, Op
//-----------------------------------------------------------------------------
bool _OMReader_::read_binary_halfedge_chunk(std::istream &_is, BaseImporter &_bi, Options & _opt, bool _swap) const
bool _OMReader_::read_binary_halfedge_chunk(std::istream &_is, BaseImporter &_bi, const Options & _opt, bool _swap) const
{
using OMFormat::Chunk;
@@ -749,7 +749,7 @@ bool _OMReader_::read_binary_halfedge_chunk(std::istream &_is, BaseImporter &_bi
//-----------------------------------------------------------------------------
bool _OMReader_::read_binary_mesh_chunk(std::istream &_is, BaseImporter &_bi, Options& _opt , bool _swap) const
bool _OMReader_::read_binary_mesh_chunk(std::istream &_is, BaseImporter &_bi, const Options& _opt , bool _swap) const
{
using OMFormat::Chunk;

View File

@@ -126,27 +126,27 @@ private:
bool read_binary_vertex_chunk( std::istream &_is,
BaseImporter &_bi,
Options &_opt,
const Options &_opt,
bool _swap) const;
bool read_binary_face_chunk( std::istream &_is,
BaseImporter &_bi,
Options &_opt,
const Options &_opt,
bool _swap) const;
bool read_binary_edge_chunk( std::istream &_is,
BaseImporter &_bi,
Options &_opt,
const Options &_opt,
bool _swap) const;
bool read_binary_halfedge_chunk( std::istream &_is,
BaseImporter &_bi,
Options &_opt,
const Options &_opt,
bool _swap) const;
bool read_binary_mesh_chunk( std::istream &_is,
BaseImporter &_bi,
Options &_opt,
const Options &_opt,
bool _swap) const;
size_t restore_binary_custom_data(std::istream& _is,

View File

@@ -142,7 +142,7 @@ bool _PLYReader_::read(std::istream& _in, BaseImporter& _bi, Options& _opt) {
}
// filter relevant options for reading
bool swap = _opt.check(Options::Swap);
bool swap_required = _opt.check(Options::Swap);
userOptions_ = _opt;
@@ -178,7 +178,7 @@ bool _PLYReader_::read(std::istream& _in, BaseImporter& _bi, Options& _opt) {
// if ( options_.is_binary() && userOptions_.color_has_alpha() )
// options_ += Options::ColorAlpha;
return (options_.is_binary() ? read_binary(_in, _bi, swap, _opt) : read_ascii(_in, _bi, _opt));
return (options_.is_binary() ? read_binary(_in, _bi, swap_required, _opt) : read_ascii(_in, _bi, _opt));
}
@@ -1384,8 +1384,7 @@ bool _PLYReader_::can_u_read(std::istream& _is) const {
elements_.push_back(element);
} else if (keyword == "property") {
std::string tmp1;
std::string tmp2;
std::string tmp1;
// Read first keyword, as it might be a list
_is >> tmp1;
@@ -1448,6 +1447,9 @@ bool _PLYReader_::can_u_read(std::istream& _is) const {
elements_.back().properties_.push_back(property);
} else {
std::string tmp2;
// as this is not a list property, read second value of property
_is >> tmp2;

View File

@@ -183,7 +183,7 @@ bool _OMWriter_::write_binary(std::ostream& _os, BaseExporter& _be,
size_t bytes = 0;
const bool swap =
const bool swap_required =
_writeOptions.check(Options::Swap) || (Endian::local() == Endian::MSB);
unsigned int i, nV, nF;
@@ -202,7 +202,7 @@ bool _OMWriter_::write_binary(std::ostream& _os, BaseExporter& _be,
header.n_faces_ = int(_be.n_faces());
header.n_edges_ = int(_be.n_edges());
bytes += store( _os, header, swap );
bytes += store( _os, header, swap_required );
// ---------------------------------------- write chunks
@@ -234,13 +234,13 @@ bool _OMWriter_::write_binary(std::ostream& _os, BaseExporter& _be,
chunk_header.bits_ = OMFormat::bits(v[0]);
}
bytes += store( _os, chunk_header, swap );
bytes += store( _os, chunk_header, swap_required );
if (_be.is_point_double())
for (i=0, nV=header.n_vertices_; i<nV; ++i)
bytes += vector_store( _os, _be.pointd(VertexHandle(i)), swap );
bytes += vector_store( _os, _be.pointd(VertexHandle(i)), swap_required );
else
for (i=0, nV=header.n_vertices_; i<nV; ++i)
bytes += vector_store( _os, _be.point(VertexHandle(i)), swap );
bytes += vector_store( _os, _be.point(VertexHandle(i)), swap_required );
}
@@ -268,13 +268,13 @@ bool _OMWriter_::write_binary(std::ostream& _os, BaseExporter& _be,
chunk_header.bits_ = OMFormat::bits(n[0]);
}
bytes += store( _os, chunk_header, swap );
bytes += store( _os, chunk_header, swap_required );
if (_be.is_normal_double())
for (i=0, nV=header.n_vertices_; i<nV; ++i)
bytes += vector_store( _os, _be.normald(VertexHandle(i)), swap );
bytes += vector_store( _os, _be.normald(VertexHandle(i)), swap_required );
else
for (i=0, nV=header.n_vertices_; i<nV; ++i)
bytes += vector_store( _os, _be.normal(VertexHandle(i)), swap );
bytes += vector_store( _os, _be.normal(VertexHandle(i)), swap_required );
}
@@ -291,9 +291,9 @@ bool _OMWriter_::write_binary(std::ostream& _os, BaseExporter& _be,
chunk_header.dim_ = OMFormat::dim( c );
chunk_header.bits_ = OMFormat::bits( c[0] );
bytes += store( _os, chunk_header, swap );
bytes += store( _os, chunk_header, swap_required );
for (i=0, nV=header.n_vertices_; i<nV; ++i)
bytes += vector_store( _os, _be.color(VertexHandle(i)), swap );
bytes += vector_store( _os, _be.color(VertexHandle(i)), swap_required );
}
// ---------- write vertex texture coords
@@ -309,10 +309,10 @@ bool _OMWriter_::write_binary(std::ostream& _os, BaseExporter& _be,
chunk_header.dim_ = OMFormat::dim(t);
chunk_header.bits_ = OMFormat::bits(t[0]);
bytes += store(_os, chunk_header, swap);
bytes += store(_os, chunk_header, swap_required);
for (i = 0, nV = header.n_vertices_; i < nV; ++i)
bytes += vector_store(_os, _be.texcoord(VertexHandle(i)), swap);
bytes += vector_store(_os, _be.texcoord(VertexHandle(i)), swap_required);
}
@@ -328,7 +328,7 @@ bool _OMWriter_::write_binary(std::ostream& _os, BaseExporter& _be,
chunk_header.dim_ = OMFormat::Chunk::Dim_3D;
chunk_header.bits_ = OMFormat::needed_bits(_be.n_edges()*4); // *2 due to halfedge ids being stored, *2 due to signedness
bytes += store( _os, chunk_header, swap );
bytes += store( _os, chunk_header, swap_required );
auto nE=header.n_edges_*2;
for (i=0; i<nE; ++i)
{
@@ -336,9 +336,9 @@ bool _OMWriter_::write_binary(std::ostream& _os, BaseExporter& _be,
auto to_vertex_id = _be.get_to_vertex_id(HalfedgeHandle(static_cast<int>(i)));
auto face_id = _be.get_face_id(HalfedgeHandle(static_cast<int>(i)));
bytes += store( _os, next_id, OMFormat::Chunk::Integer_Size(chunk_header.bits_), swap );
bytes += store( _os, to_vertex_id, OMFormat::Chunk::Integer_Size(chunk_header.bits_), swap );
bytes += store( _os, face_id, OMFormat::Chunk::Integer_Size(chunk_header.bits_), swap );
bytes += store( _os, next_id, OMFormat::Chunk::Integer_Size(chunk_header.bits_), swap_required );
bytes += store( _os, to_vertex_id, OMFormat::Chunk::Integer_Size(chunk_header.bits_), swap_required );
bytes += store( _os, face_id, OMFormat::Chunk::Integer_Size(chunk_header.bits_), swap_required );
}
}
@@ -357,11 +357,11 @@ bool _OMWriter_::write_binary(std::ostream& _os, BaseExporter& _be,
chunk_header.dim_ = OMFormat::dim(t);
chunk_header.bits_ = OMFormat::bits(t[0]);
bytes += store(_os, chunk_header, swap);
bytes += store(_os, chunk_header, swap_required);
unsigned int nHE;
for (i = 0, nHE = header.n_edges_*2; i < nHE; ++i)
bytes += vector_store(_os, _be.texcoord(HalfedgeHandle(i)), swap);
bytes += vector_store(_os, _be.texcoord(HalfedgeHandle(i)), swap_required);
}
//---------------------------------------------------------------
@@ -378,9 +378,9 @@ bool _OMWriter_::write_binary(std::ostream& _os, BaseExporter& _be,
chunk_header.dim_ = OMFormat::Chunk::Dim_1D;
chunk_header.bits_ = OMFormat::needed_bits(_be.n_edges()*4); // *2 due to halfedge ids being stored, *2 due to signedness
bytes += store( _os, chunk_header, swap );
bytes += store( _os, chunk_header, swap_required );
for (i=0, nV=header.n_vertices_; i<nV; ++i)
bytes += store( _os, _be.get_halfedge_id(VertexHandle(i)), OMFormat::Chunk::Integer_Size(chunk_header.bits_), swap );
bytes += store( _os, _be.get_halfedge_id(VertexHandle(i)), OMFormat::Chunk::Integer_Size(chunk_header.bits_), swap_required );
}
@@ -396,12 +396,12 @@ bool _OMWriter_::write_binary(std::ostream& _os, BaseExporter& _be,
chunk_header.dim_ = OMFormat::Chunk::Dim_1D;
chunk_header.bits_ = OMFormat::needed_bits(_be.n_edges()*4); // *2 due to halfedge ids being stored, *2 due to signedness
bytes += store( _os, chunk_header, swap );
bytes += store( _os, chunk_header, swap_required );
for (i=0, nF=header.n_faces_; i<nF; ++i)
{
auto size = OMFormat::Chunk::Integer_Size(chunk_header.bits_);
bytes += store( _os, _be.get_halfedge_id(FaceHandle(i)), size, swap);
bytes += store( _os, _be.get_halfedge_id(FaceHandle(i)), size, swap_required);
}
}
@@ -438,14 +438,14 @@ bool _OMWriter_::write_binary(std::ostream& _os, BaseExporter& _be,
chunk_header.bits_ = OMFormat::bits(n[0]);
}
bytes += store( _os, chunk_header, swap );
bytes += store( _os, chunk_header, swap_required );
#if !NEW_STYLE
if (_be.is_normal_double())
for (i=0, nF=header.n_faces_; i<nF; ++i)
bytes += vector_store( _os, _be.normald(FaceHandle(i)), swap );
bytes += vector_store( _os, _be.normald(FaceHandle(i)), swap_required );
else
for (i=0, nF=header.n_faces_; i<nF; ++i)
bytes += vector_store( _os, _be.normal(FaceHandle(i)), swap );
bytes += vector_store( _os, _be.normal(FaceHandle(i)), swap_required );
#else
bytes += bp->store(_os, swap );
@@ -478,10 +478,10 @@ bool _OMWriter_::write_binary(std::ostream& _os, BaseExporter& _be,
chunk_header.dim_ = OMFormat::dim( c );
chunk_header.bits_ = OMFormat::bits( c[0] );
bytes += store( _os, chunk_header, swap );
bytes += store( _os, chunk_header, swap_required );
#if !NEW_STYLE
for (i=0, nF=header.n_faces_; i<nF; ++i)
bytes += vector_store( _os, _be.color(FaceHandle(i)), swap );
bytes += vector_store( _os, _be.color(FaceHandle(i)), swap_required );
#else
bytes += bp->store(_os, swap);
}
@@ -503,10 +503,10 @@ bool _OMWriter_::write_binary(std::ostream& _os, BaseExporter& _be,
chunk_header.bits_ = OMFormat::bits(s);
// std::clog << chunk_header << std::endl;
bytes += store(_os, chunk_header, swap);
bytes += store(_os, chunk_header, swap_required);
for (i = 0, nV = header.n_vertices_; i < nV; ++i)
bytes += store(_os, _be.status(VertexHandle(i)), swap);
bytes += store(_os, _be.status(VertexHandle(i)), swap_required);
}
// ---------- write edge status
@@ -522,10 +522,10 @@ bool _OMWriter_::write_binary(std::ostream& _os, BaseExporter& _be,
chunk_header.bits_ = OMFormat::bits(s);
// std::clog << chunk_header << std::endl;
bytes += store(_os, chunk_header, swap);
bytes += store(_os, chunk_header, swap_required);
for (i = 0, nV = header.n_edges_; i < nV; ++i)
bytes += store(_os, _be.status(EdgeHandle(i)), swap);
bytes += store(_os, _be.status(EdgeHandle(i)), swap_required);
}
// ---------- write halfedge status
@@ -541,10 +541,10 @@ bool _OMWriter_::write_binary(std::ostream& _os, BaseExporter& _be,
chunk_header.bits_ = OMFormat::bits(s);
// std::clog << chunk_header << std::endl;
bytes += store(_os, chunk_header, swap);
bytes += store(_os, chunk_header, swap_required);
for (i = 0, nV = header.n_edges_ * 2; i < nV; ++i)
bytes += store(_os, _be.status(HalfedgeHandle(i)), swap);
bytes += store(_os, _be.status(HalfedgeHandle(i)), swap_required);
}
// ---------- write face status
@@ -560,17 +560,17 @@ bool _OMWriter_::write_binary(std::ostream& _os, BaseExporter& _be,
chunk_header.bits_ = OMFormat::bits(s);
// std::clog << chunk_header << std::endl;
bytes += store(_os, chunk_header, swap);
bytes += store(_os, chunk_header, swap_required);
for (i = 0, nV = header.n_faces_; i < nV; ++i)
bytes += store(_os, _be.status(FaceHandle(i)), swap);
bytes += store(_os, _be.status(FaceHandle(i)), swap_required);
}
// -------------------- write custom properties
if (_writeOptions.check(Options::Custom))
{
const auto store_property = [this, &_os, swap, &bytes](
const auto store_property = [this, &_os, swap_required, &bytes](
const BaseKernel::const_prop_iterator _it_begin,
const BaseKernel::const_prop_iterator _it_end,
const OMFormat::Chunk::Entity _ent)
@@ -582,7 +582,7 @@ bool _OMWriter_::write_binary(std::ostream& _os, BaseExporter& _be,
{ // skip dead and "private" properties (no name or name matches "?:*")
continue;
}
bytes += store_binary_custom_chunk(_os, **prop, _ent, swap);
bytes += store_binary_custom_chunk(_os, **prop, _ent, swap_required);
}
};
@@ -601,7 +601,7 @@ bool _OMWriter_::write_binary(std::ostream& _os, BaseExporter& _be,
memset(&chunk_header, 0, sizeof(chunk_header));
chunk_header.name_ = false;
chunk_header.entity_ = OMFormat::Chunk::Entity_Sentinel;
bytes += store(_os, chunk_header, swap);
bytes += store(_os, chunk_header, swap_required);
omlog() << "#bytes written: " << bytes << std::endl;

View File

@@ -139,7 +139,7 @@ write(std::ostream& _os, BaseExporter& _be, const Options& _writeOptions, std::s
bool
_STLWriter_::
write_stla(const std::string& _filename, BaseExporter& _be, Options /* _opt */) const
write_stla(const std::string& _filename, const BaseExporter& _be, Options /* _opt */) const
{
omlog() << "[STLWriter] : write ascii file\n";
@@ -204,7 +204,7 @@ write_stla(const std::string& _filename, BaseExporter& _be, Options /* _opt */)
bool
_STLWriter_::
write_stla(std::ostream& _out, BaseExporter& _be, Options /* _opt */, std::streamsize _precision) const
write_stla(std::ostream& _out, const BaseExporter& _be, Options /* _opt */, std::streamsize _precision) const
{
omlog() << "[STLWriter] : write ascii file\n";
@@ -256,7 +256,7 @@ write_stla(std::ostream& _out, BaseExporter& _be, Options /* _opt */, std::strea
bool
_STLWriter_::
write_stlb(const std::string& _filename, BaseExporter& _be, Options /* _opt */) const
write_stlb(const std::string& _filename, const BaseExporter& _be, Options /* _opt */) const
{
omlog() << "[STLWriter] : write binary file\n";
@@ -336,7 +336,7 @@ write_stlb(const std::string& _filename, BaseExporter& _be, Options /* _opt */)
bool
_STLWriter_::
write_stlb(std::ostream& _out, BaseExporter& _be, Options /* _opt */, std::streamsize _precision) const
write_stlb(std::ostream& _out, const BaseExporter& _be, Options /* _opt */, std::streamsize _precision) const
{
omlog() << "[STLWriter] : write binary file\n";

View File

@@ -98,10 +98,10 @@ public:
size_t binary_size(BaseExporter&, const Options&) const override;
private:
bool write_stla(const std::string&, BaseExporter&, Options) const;
bool write_stla(std::ostream&, BaseExporter&, Options, std::streamsize _precision = 6) const;
bool write_stlb(const std::string&, BaseExporter&, Options) const;
bool write_stlb(std::ostream&, BaseExporter&, Options, std::streamsize _precision = 6) const;
bool write_stla(const std::string&, const BaseExporter&, Options) const;
bool write_stla(std::ostream&, const BaseExporter&, Options, std::streamsize _precision = 6) const;
bool write_stlb(const std::string&, const BaseExporter&, Options) const;
bool write_stlb(std::ostream&, const BaseExporter&, Options, std::streamsize _precision = 6) const;
};

View File

@@ -40,8 +40,6 @@ bool _VTKWriter_::write(const std::string& _filename, BaseExporter& _be, const O
bool _VTKWriter_::write(std::ostream& _out, BaseExporter& _be, const Options& _writeOptions, std::streamsize _precision) const
{
VertexHandle vh;
// check exporter features
if (!check(_be, _writeOptions)) {
return false;

View File

@@ -738,7 +738,7 @@ public:
typedef typename HandleContainer::const_iterator
const_iterator;
public:
ExtStatusSetT(ArrayKernel& _kernel, size_t _capacity_hint = 0)
explicit ExtStatusSetT(ArrayKernel& _kernel, size_t _capacity_hint = 0)
: Base(_kernel)
{ handles_.reserve(_capacity_hint); }

View File

@@ -68,18 +68,18 @@ namespace Iterators {
template<class Mesh, class CenterEntityHandle, bool CW>
class GenericCirculator_CenterEntityFnsT {
public:
static void increment(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, typename Mesh::HalfedgeHandle &start, int &lap_counter);
static void decrement(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, typename Mesh::HalfedgeHandle &start, int &lap_counter);
static void increment(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, const typename Mesh::HalfedgeHandle &start, int &lap_counter);
static void decrement(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, const typename Mesh::HalfedgeHandle &start, int &lap_counter);
};
template<class Mesh>
class GenericCirculator_CenterEntityFnsT<Mesh, typename Mesh::VertexHandle, true> {
public:
inline static void increment(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, typename Mesh::HalfedgeHandle &start, int &lap_counter) {
inline static void increment(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, const typename Mesh::HalfedgeHandle &start, int &lap_counter) {
heh = mesh->cw_rotated_halfedge_handle(heh);
if (heh == start) ++lap_counter;
}
inline static void decrement(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, typename Mesh::HalfedgeHandle &start, int &lap_counter) {
inline static void decrement(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, const typename Mesh::HalfedgeHandle &start, int &lap_counter) {
if (heh == start) --lap_counter;
heh = mesh->ccw_rotated_halfedge_handle(heh);
}
@@ -88,11 +88,11 @@ class GenericCirculator_CenterEntityFnsT<Mesh, typename Mesh::VertexHandle, true
template<class Mesh>
class GenericCirculator_CenterEntityFnsT<Mesh, typename Mesh::FaceHandle, true> {
public:
inline static void increment(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, typename Mesh::HalfedgeHandle &start, int &lap_counter) {
inline static void increment(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, const typename Mesh::HalfedgeHandle &start, int &lap_counter) {
heh = mesh->next_halfedge_handle(heh);
if (heh == start) ++lap_counter;
}
inline static void decrement(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, typename Mesh::HalfedgeHandle &start, int &lap_counter) {
inline static void decrement(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, const typename Mesh::HalfedgeHandle &start, int &lap_counter) {
if (heh == start) --lap_counter;
heh = mesh->prev_halfedge_handle(heh);
}
@@ -104,11 +104,11 @@ class GenericCirculator_CenterEntityFnsT<Mesh, typename Mesh::FaceHandle, true>
template<class Mesh>
class GenericCirculator_CenterEntityFnsT<Mesh, typename Mesh::VertexHandle, false> {
public:
inline static void increment(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, typename Mesh::HalfedgeHandle &start, int &lap_counter) {
inline static void increment(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, const typename Mesh::HalfedgeHandle &start, int &lap_counter) {
heh = mesh->ccw_rotated_halfedge_handle(heh);
if (heh == start) ++lap_counter;
}
inline static void decrement(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, typename Mesh::HalfedgeHandle &start, int &lap_counter) {
inline static void decrement(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, const typename Mesh::HalfedgeHandle &start, int &lap_counter) {
if (heh == start) --lap_counter;
heh = mesh->cw_rotated_halfedge_handle(heh);
}
@@ -117,11 +117,11 @@ class GenericCirculator_CenterEntityFnsT<Mesh, typename Mesh::VertexHandle, fals
template<class Mesh>
class GenericCirculator_CenterEntityFnsT<Mesh, typename Mesh::FaceHandle, false> {
public:
inline static void increment(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, typename Mesh::HalfedgeHandle &start, int &lap_counter) {
inline static void increment(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, const typename Mesh::HalfedgeHandle &start, int &lap_counter) {
heh = mesh->prev_halfedge_handle(heh);
if (heh == start) ++lap_counter;
}
inline static void decrement(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, typename Mesh::HalfedgeHandle &start, int &lap_counter) {
inline static void decrement(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, const typename Mesh::HalfedgeHandle &start, int &lap_counter) {
if (heh == start) --lap_counter;
heh = mesh->next_halfedge_handle(heh);
}
@@ -171,10 +171,10 @@ class GenericCirculator_ValueHandleFnsT {
}
}
inline static void increment(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, typename Mesh::HalfedgeHandle &start, int &lap_counter) {
inline static void increment(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, const typename Mesh::HalfedgeHandle &start, int &lap_counter) {
GenericCirculator_CenterEntityFnsT<Mesh, CenterEntityHandle, CW>::increment(mesh, heh, start, lap_counter);
}
inline static void decrement(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, typename Mesh::HalfedgeHandle &start, int &lap_counter) {
inline static void decrement(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, const typename Mesh::HalfedgeHandle &start, int &lap_counter) {
GenericCirculator_CenterEntityFnsT<Mesh, CenterEntityHandle, CW>::decrement(mesh, heh, start, lap_counter);
}
};
@@ -426,10 +426,10 @@ class GenericCirculator_ValueHandleFnsT_DEPRECATED {
return ( heh.is_valid() && ((start != heh) || (lap_counter == 0 )) );
}
inline static void init(const Mesh*, typename Mesh::HalfedgeHandle&, typename Mesh::HalfedgeHandle&, int&) {};
inline static void increment(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, typename Mesh::HalfedgeHandle &start, int &lap_counter) {
inline static void increment(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, const typename Mesh::HalfedgeHandle &start, int &lap_counter) {
GenericCirculator_CenterEntityFnsT<Mesh, CenterEntityHandle, true>::increment(mesh, heh, start, lap_counter);
}
inline static void decrement(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, typename Mesh::HalfedgeHandle &start, int &lap_counter) {
inline static void decrement(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, const typename Mesh::HalfedgeHandle &start, int &lap_counter) {
GenericCirculator_CenterEntityFnsT<Mesh, CenterEntityHandle, true>::decrement(mesh, heh, start, lap_counter);
}
};
@@ -442,16 +442,16 @@ class GenericCirculator_ValueHandleFnsT_DEPRECATED<Mesh, CenterEntityHandle, typ
inline static bool is_valid(const typename Mesh::HalfedgeHandle &heh, const typename Mesh::HalfedgeHandle &start, const int lap_counter) {
return ( heh.is_valid() && ((start != heh) || (lap_counter == 0 )));
}
inline static void init(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, typename Mesh::HalfedgeHandle &start, int &lap_counter) {
inline static void init(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, const typename Mesh::HalfedgeHandle &start, int &lap_counter) {
if (heh.is_valid() && !GenericCirculator_DereferenciabilityCheck::isDereferenciable(mesh, heh) && lap_counter == 0 )
increment(mesh, heh, start, lap_counter);
};
inline static void increment(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, typename Mesh::HalfedgeHandle &start, int &lap_counter) {
inline static void increment(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, const typename Mesh::HalfedgeHandle &start, int &lap_counter) {
do {
GenericCirculator_CenterEntityFnsT<Mesh, CenterEntityHandle, true>::increment(mesh, heh, start, lap_counter);
} while (is_valid(heh, start, lap_counter) && !GenericCirculator_DereferenciabilityCheck::isDereferenciable(mesh, heh));
}
inline static void decrement(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, typename Mesh::HalfedgeHandle &start, int &lap_counter) {
inline static void decrement(const Mesh *mesh, typename Mesh::HalfedgeHandle &heh, const typename Mesh::HalfedgeHandle &start, int &lap_counter) {
do {
GenericCirculator_CenterEntityFnsT<Mesh, CenterEntityHandle, true>::decrement(mesh, heh, start, lap_counter);
} while (is_valid(heh, start, lap_counter) && !GenericCirculator_DereferenciabilityCheck::isDereferenciable(mesh, heh));

View File

@@ -174,7 +174,7 @@ PolyConnectivity::add_face(const VertexHandle* _vertex_handles, size_t _vhs_size
// search a free gap
// free gap will be between boundary_prev and boundary_next
outer_prev = opposite_halfedge_handle(inner_next);
outer_next = opposite_halfedge_handle(inner_prev);
//outer_next = opposite_halfedge_handle(inner_prev);
boundary_prev = outer_prev;
do
boundary_prev =
@@ -494,11 +494,8 @@ void PolyConnectivity::delete_vertex(VertexHandle _vh, bool _delete_isolated_ver
// delete collected faces
std::vector<FaceHandle>::iterator fh_it(face_handles.begin()),
fh_end(face_handles.end());
for (; fh_it!=fh_end; ++fh_it)
delete_face(*fh_it, _delete_isolated_vertices);
for (auto delete_fh_it : face_handles)
delete_face(delete_fh_it, _delete_isolated_vertices);
status(_vh).set_deleted(true);
}

View File

@@ -286,7 +286,7 @@ class PropertyManager {
Storage::swap(rhs, *this);
}
static bool propertyExists(PolyConnectivity &mesh, const char *propname) {
static bool propertyExists(const PolyConnectivity &mesh, const char *propname) {
PROPTYPE dummy;
return mesh.get_property_handle(dummy, propname);
}

View File

@@ -11,14 +11,14 @@
#ifndef DOXY_IGNORE_THIS
struct MyTraits : public OpenMesh::DefaultTraits
struct MySmootherExampleTraits : public OpenMesh::DefaultTraits
{
HalfedgeAttributes(OpenMesh::Attributes::PrevHalfedge);
};
#endif
typedef OpenMesh::TriMesh_ArrayKernelT<MyTraits> MyMesh;
typedef OpenMesh::TriMesh_ArrayKernelT<MySmootherExampleTraits> MyMesh;
// ----------------------------------------------------------------------------

View File

@@ -9,7 +9,7 @@
#ifndef DOXY_IGNORE_THIS
// Define my personal traits
struct MyTraits : OpenMesh::DefaultTraits
struct MyAttributesExampleTraits : OpenMesh::DefaultTraits
{
// Let Point and Normal be a vector of doubles
typedef OpenMesh::Vec3d Point;
@@ -29,7 +29,7 @@ struct MyTraits : OpenMesh::DefaultTraits
#endif
// Define my mesh with the new traits!
typedef OpenMesh::TriMesh_ArrayKernelT<MyTraits> MyMesh;
typedef OpenMesh::TriMesh_ArrayKernelT<MyAttributesExampleTraits> MyMesh;
// ------------------------------------------------------------------ main ----

View File

@@ -5,7 +5,7 @@
#include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
#include <OpenMesh/Core/Mesh/Traits.hh>
struct MyTraits : public OpenMesh::DefaultTraits
struct MyMeshSmootherExampleTraits : public OpenMesh::DefaultTraits
{
// store barycenter of neighbors in this member
VertexTraits
@@ -21,7 +21,7 @@ struct MyTraits : public OpenMesh::DefaultTraits
};
};
typedef OpenMesh::TriMesh_ArrayKernelT<MyTraits> MyMesh;
typedef OpenMesh::TriMesh_ArrayKernelT<MyMeshSmootherExampleTraits> MyMesh;
typedef OpenMesh::TriMesh_ArrayKernelT<> MyMesh2;
// ---------------------------------------------------------------------------

View File

@@ -49,7 +49,7 @@
// ----------------------------------------------------------------------------
struct MyTraits : public OpenMesh::DefaultTraits
struct MyDeleteGeometryExampleTraits : public OpenMesh::DefaultTraits
{
VertexAttributes(OpenMesh::Attributes::Status);
FaceAttributes(OpenMesh::Attributes::Status);
@@ -57,7 +57,7 @@ struct MyTraits : public OpenMesh::DefaultTraits
};
typedef OpenMesh::PolyMesh_ArrayKernelT<MyTraits> MyMesh;
typedef OpenMesh::PolyMesh_ArrayKernelT<MyDeleteGeometryExampleTraits> MyMesh;
// ----------------------------------------------------------------------------

View File

@@ -9,7 +9,7 @@ template <typename Mesh>
bool
fill_props( Mesh& _m, OpenMesh::VPropHandleT<float> _ph, bool _check=false)
{
static float a[9] = { 1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f };
const static float a[9] = { 1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f };
for(typename Mesh::VertexIter it=_m.vertices_begin();
it != _m.vertices_end(); ++it)
@@ -69,10 +69,10 @@ template <typename Mesh, typename T>
bool
fill_props( Mesh& _m, OpenMesh::HPropHandleT<T> _ph, bool _check=false)
{
static float a[9] = { 1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f };
static float b[9] = { 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f, 1.1f };
static float c[9] = { 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f, 1.1f, 2.2f };
static float d[9] = { 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f, 1.1f, 2.2f, 3.3f };
const static float a[9] = { 1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f };
const static float b[9] = { 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f, 1.1f };
const static float c[9] = { 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f, 1.1f, 2.2f };
const static float d[9] = { 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f, 1.1f, 2.2f, 3.3f };
// static double values[9] = { 0.1, 0.02, 0.003, 0.0004, 0.00005, 0.000006,
// 0.0000007, 0.00000008, 0.000000009 };

View File

@@ -27,12 +27,10 @@ std::string int2roman( size_t decimal, size_t length )
size_t power; // power of ten
size_t index; // Indexes thru values to subtract
std::string roman;
std::string roman('\0');
roman.reserve(length);
roman[ 0 ] = '\0';
for ( power = 0; power < nrows; power++ )
for ( index = 0; index < ncols; index++ )
while ( decimal >= table_arabs[ power ][ index ] )

View File

@@ -88,7 +88,7 @@ class ModAspectRatioT: public ModBaseT<MeshT> {
typedef typename Mesh::Point Point;
/// constructor
ModAspectRatioT(MeshT& _mesh, float _min_aspect = 5.0, bool _is_binary =
explicit ModAspectRatioT(MeshT& _mesh, float _min_aspect = 5.0, bool _is_binary =
true) :
Base(_mesh, _is_binary), mesh_(Base::mesh()), min_aspect_(
1.f / _min_aspect) {

View File

@@ -79,7 +79,7 @@ class ModEdgeLengthT: public ModBaseT<MeshT> {
;
/// Constructor
ModEdgeLengthT(MeshT& _mesh, float _edge_length = FLT_MAX,
explicit ModEdgeLengthT(MeshT& _mesh, float _edge_length = FLT_MAX,
bool _is_binary = true);
/// get edge_length

View File

@@ -85,8 +85,8 @@ void ModEdgeLengthT<MeshT>::set_error_tolerance_factor(double _factor) {
// the smaller the factor, the smaller edge_length_ gets
// thus creating a stricter constraint
// division by error_tolerance_factor_ is for normalization
typename Mesh::Scalar edge_length = edge_length_ * static_cast<typename Mesh::Scalar>(_factor / this->error_tolerance_factor_);
set_edge_length(edge_length);
typename Mesh::Scalar new_edge_length = edge_length_ * static_cast<typename Mesh::Scalar>(_factor / this->error_tolerance_factor_);
set_edge_length(new_edge_length);
this->error_tolerance_factor_ = _factor;
}
}

View File

@@ -87,7 +87,7 @@ class ModHausdorffT: public ModBaseT<MeshT> {
typedef std::vector<Point> Points;
/// Constructor
ModHausdorffT(MeshT& _mesh, Scalar _error_tolerance = FLT_MAX) :
explicit ModHausdorffT(MeshT& _mesh, Scalar _error_tolerance = FLT_MAX) :
Base(_mesh, true), mesh_(Base::mesh()), tolerance_(_error_tolerance) {
mesh_.add_property(points_);
}

View File

@@ -267,8 +267,8 @@ void ModHausdorffT<MeshT>::set_error_tolerance_factor(double _factor) {
// the smaller the factor, the smaller tolerance gets
// thus creating a stricter constraint
// division by error_tolerance_factor_ is for normalization
Scalar tolerance = tolerance_ * Scalar(_factor / this->error_tolerance_factor_);
set_tolerance(tolerance);
Scalar new_tolerance = tolerance_ * Scalar(_factor / this->error_tolerance_factor_);
set_tolerance(new_tolerance);
this->error_tolerance_factor_ = _factor;
}
}

View File

@@ -86,10 +86,6 @@ class ModIndependentSetsT: public ModBaseT<MeshT> {
Base::mesh().status(*vv_it).set_locked(true);
}
private:
/// hide this method
void set_binary(bool _b) { }
};
//=============================================================================

View File

@@ -104,7 +104,7 @@ public:
public:
/// Constructor
ModNormalDeviationT(MeshT& _mesh, float _max_dev = 180.0)
explicit ModNormalDeviationT(MeshT& _mesh, float _max_dev = 180.0)
: Base(_mesh, true), mesh_(Base::mesh())
{
set_normal_deviation(_max_dev);

View File

@@ -181,11 +181,6 @@ public:
min_cos_ = cos(max_deviation_);
}
private:
// hide this method
void set_binary(bool _b) {}
private:
// maximum normal deviation

View File

@@ -171,9 +171,6 @@ public: // specific methods
private:
// hide this method form user
void set_binary(bool _b) {}
InfoList pmi_;
VPropHandleT<size_t> idx_;
};

View File

@@ -139,8 +139,8 @@ void ModQuadricT<MeshT>::set_error_tolerance_factor(double _factor) {
// the smaller the factor, the smaller max_err_ gets
// thus creating a stricter constraint
// division by error_tolerance_factor_ is for normalization
double max_err = max_err_ * _factor / this->error_tolerance_factor_;
set_max_err(max_err);
double new_max_err = max_err_ * _factor / this->error_tolerance_factor_;
set_max_err(new_max_err);
this->error_tolerance_factor_ = _factor;
initialize();

View File

@@ -106,10 +106,10 @@ struct CompositeTraits : public OpenMesh::DefaultTraits
void set_green() {red_ = 0; }
bool is_red() { return red_; }
bool is_green() { return !red_; }
void set_red_halfedge_handle(HalfedgeHandle& _heh)
void set_red_halfedge_handle(const HalfedgeHandle& _heh)
{ red_halfedge_handle_ = _heh; }
HalfedgeHandle& red_halfedge_handle() { return red_halfedge_handle_; }
void set_quality(Scalar& _q) { quality_ = _q; }
void set_quality(const Scalar& _q) { quality_ = _q; }
Scalar& quality() { return quality_; }
const Point& midpoint() const { return midpoint_; }
void set_midpoint(const Point& _p) { midpoint_ = _p; }

View File

@@ -126,7 +126,7 @@ Gnuplot::Gnuplot(const string &style)
Gnuplot::Gnuplot(const string &title,
const string &style,
const string &labelx, const string &labely,
vector<double> x, vector<double> y)
const vector<double>& x, const vector<double>& y)
{
init();
@@ -157,7 +157,7 @@ Gnuplot::Gnuplot(const string &title,
Gnuplot::Gnuplot(const string &title, const string &style,
const string &labelx, const string &labely,
vector<double> x)
const vector<double>& x)
{
init();
@@ -349,7 +349,7 @@ void Gnuplot::plot_equation(const string &equation, const string &title)
// ----------------------------------------------------------------------------
void Gnuplot::plot_x(vector<double> d, const string &title)
void Gnuplot::plot_x(const vector<double>& d, const string &title)
{
ofstream tmp;
ostringstream cmdstr;
@@ -418,7 +418,7 @@ void Gnuplot::plot_x(vector<double> d, const string &title)
// ----------------------------------------------------------------------------
void Gnuplot::plot_xy(vector<double> x, vector<double> y, const string &title)
void Gnuplot::plot_xy(const vector<double>& x, const vector<double>& y, const string &title)
{
ofstream tmp;
ostringstream cmdstr;

View File

@@ -120,14 +120,14 @@ public:
const string & _style,
const string & _xlabel,
const string & _ylabel,
vector<double> _x, vector<double> _y);
const vector<double>& _x, const vector<double>& _y);
/// Constructor calling plot_x().
Gnuplot(const string &_title,
const string &_style,
const string &_xlabel,
const string &_ylabel,
vector<double> _x);
const vector<double>& _x);
//@}
~Gnuplot();
@@ -146,10 +146,10 @@ public:
//@{
/// Plot a single vector
void plot_x(vector<double> _x, const string &_title);
void plot_x(const vector<double>& _x, const string &_title);
/// Plot x,y pairs
void plot_xy(vector<double> _x, vector<double> _y, const string &_title);
void plot_xy(const vector<double>& _x, const vector<double>& _y, const string &_title);
/// Plot an equation of the form: y = ax + b
/// You supply a and b

View File

@@ -146,8 +146,8 @@ public:
HeapT() : HeapVector() {}
#if (defined(_MSC_VER) && (_MSC_VER >= 1800)) || __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__)
/// Construct with a given \c HeapIterface.
HeapT(HeapInterface _interface)
/// Construct with a given \c HeapIterface.
explicit HeapT(HeapInterface _interface)
: HeapVector(), interface_(std::move(_interface))
{}
#else

View File

@@ -95,7 +95,7 @@ check(unsigned int _targets, std::ostream& _os)
}
}
if (heh.is_valid()) {
if (heh.idx() < -1 || heh.idx() >= mesh_.n_halfedges()) {
if (heh.idx() < -1 || heh.idx() >= (int)mesh_.n_halfedges()) {
_os << "MeshChecker: vertex " << vh
<< " has out-of-bounds outgoing HE: " << heh;
ok = false;
@@ -147,8 +147,8 @@ check(unsigned int _targets, std::ostream& _os)
{
typename Mesh::ConstHalfedgeIter h_it(mesh_.halfedges_begin()),
h_end(mesh_.halfedges_end());
typename Mesh::HalfedgeHandle hh, hstart, hhh;
size_t count, n_halfedges = 2*mesh_.n_edges();
typename Mesh::HalfedgeHandle hstart, hhh;
size_t n_halfedges = 2*mesh_.n_edges();
for (const auto hh: mesh_.halfedges())
{
@@ -193,7 +193,7 @@ check(unsigned int _targets, std::ostream& _os)
// halfedges should form a cycle
count=0; hstart=hhh=hh;
size_t count=0; hstart=hhh=hh;
do
{
hhh = mesh_.next_halfedge_handle(hhh);
@@ -217,7 +217,6 @@ check(unsigned int _targets, std::ostream& _os)
{
typename Mesh::ConstFaceIter f_it(mesh_.faces_begin()),
f_end(mesh_.faces_end());
typename Mesh::FaceHandle fh;
typename Mesh::ConstFaceHalfedgeIter fh_it;
for(const auto fh: mesh_.faces()) {

View File

@@ -111,7 +111,9 @@ TimerImplWin32::TimerImplWin32(void)
{
if (QueryPerformanceFrequency(&freq_)==FALSE)
throw std::runtime_error("Performance counter of of stock!");
reset();
memset(&count_,0,sizeof(count_));
memset(&start_,0,sizeof(count_));
}
void TimerImplWin32::reset(void)
@@ -231,7 +233,7 @@ static const unsigned long clockticks = CLOCKS_PER_SEC;
class TimerImplStd : public TimerImpl
{
public:
TimerImplStd() : freq_(clockticks),count_(0),start_(0) { reset(); }
TimerImplStd() : freq_(clockticks),count_(0),start_(0) { }
~TimerImplStd() { ; }
virtual void reset(void) override { count_ = 0; }

View File

@@ -99,16 +99,16 @@ add_node(const VHierarchyNode &_node)
void
VHierarchy::
make_children(VHierarchyNodeHandle &_parent_handle)
make_children(const VHierarchyNodeHandle &_parent_handle)
{
VHierarchyNodeHandle lchild_handle = add_node();
VHierarchyNodeHandle rchild_handle = add_node();
VHierarchyNodeHandle new_lchild_handle = add_node();
VHierarchyNodeHandle new_rchild_handle = add_node();
VHierarchyNode &parent = node(_parent_handle);
VHierarchyNode &lchild = node(lchild_handle);
VHierarchyNode &rchild = node(rchild_handle);
VHierarchyNode &lchild = node(new_lchild_handle);
VHierarchyNode &rchild = node(new_rchild_handle);
parent.set_children_handle(lchild_handle);
parent.set_children_handle(new_lchild_handle);
lchild.set_parent_handle(_parent_handle);
rchild.set_parent_handle(_parent_handle);

View File

@@ -119,7 +119,7 @@ public:
VHierarchyNodeHandle add_node();
VHierarchyNodeHandle add_node(const VHierarchyNode &_node);
void make_children(VHierarchyNodeHandle &_parent_handle);
void make_children(const VHierarchyNodeHandle &_parent_handle);
bool is_ancestor(VHierarchyNodeIndex _ancestor_index,
VHierarchyNodeIndex _descendent_index);