cppcheck
git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@936 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
@@ -275,8 +275,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
//
|
//
|
||||||
MyMesh::FaceFaceIter ff_it;
|
MyMesh::FaceFaceIter ff_it;
|
||||||
double quality(0.0), face_quality, temp_quality;
|
double quality(0.0);
|
||||||
int valence;
|
|
||||||
|
|
||||||
// ---------------------------------------- subdivide
|
// ---------------------------------------- subdivide
|
||||||
std::cout << "\nSubdividing...\n";
|
std::cout << "\nSubdividing...\n";
|
||||||
@@ -306,7 +305,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
for (f_it = mesh.faces_begin(); f_it != mesh.faces_end(); ++f_it) {
|
for (f_it = mesh.faces_begin(); f_it != mesh.faces_end(); ++f_it) {
|
||||||
|
|
||||||
if (mesh.data(*f_it).state() < target1) {
|
if (mesh.data(*f_it).state() < int(target1) ) {
|
||||||
++i;
|
++i;
|
||||||
fh = *f_it;
|
fh = *f_it;
|
||||||
timer2.start();
|
timer2.start();
|
||||||
@@ -317,7 +316,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
for (v_it = mesh.vertices_begin(); v_it != mesh.vertices_end(); ++v_it) {
|
for (v_it = mesh.vertices_begin(); v_it != mesh.vertices_end(); ++v_it) {
|
||||||
|
|
||||||
if (mesh.data(*v_it).state() < target2) {
|
if (mesh.data(*v_it).state() < int(target2) ) {
|
||||||
vh = *v_it;
|
vh = *v_it;
|
||||||
timer2.cont();
|
timer2.cont();
|
||||||
subdivider.refine(vh);
|
subdivider.refine(vh);
|
||||||
@@ -355,12 +354,12 @@ int main(int argc, char **argv)
|
|||||||
// check every face
|
// check every face
|
||||||
for (f_it = mesh.faces_begin(); f_it != mesh.faces_end(); ++f_it) {
|
for (f_it = mesh.faces_begin(); f_it != mesh.faces_end(); ++f_it) {
|
||||||
|
|
||||||
face_quality = 0.0;
|
double face_quality = 0.0;
|
||||||
valence = 0;
|
int valence = 0;
|
||||||
|
|
||||||
for (ff_it = mesh.ff_iter(*f_it); ff_it.is_valid(); ++ff_it) {
|
for (ff_it = mesh.ff_iter(*f_it); ff_it.is_valid(); ++ff_it) {
|
||||||
|
|
||||||
temp_quality = OpenMesh::dot( mesh.normal(*f_it), mesh.normal(*ff_it) );
|
double temp_quality = OpenMesh::dot( mesh.normal(*f_it), mesh.normal(*ff_it) );
|
||||||
|
|
||||||
if (temp_quality >= 1.0)
|
if (temp_quality >= 1.0)
|
||||||
temp_quality = .99;
|
temp_quality = .99;
|
||||||
|
|||||||
@@ -808,19 +808,18 @@ void
|
|||||||
compute_cone_of_normals(VHierarchyNodeHandle node_handle,
|
compute_cone_of_normals(VHierarchyNodeHandle node_handle,
|
||||||
VHierarchyNodeHandleContainer &leaf_nodes)
|
VHierarchyNodeHandleContainer &leaf_nodes)
|
||||||
{
|
{
|
||||||
float max_angle, angle;
|
|
||||||
Vec3f n, ln;
|
Vec3f n, ln;
|
||||||
VertexHandle vh = vhierarchy_.node(node_handle).vertex_handle();
|
VertexHandle vh = vhierarchy_.node(node_handle).vertex_handle();
|
||||||
VHierarchyNodeHandleContainer::iterator n_it, n_end(leaf_nodes.end());
|
VHierarchyNodeHandleContainer::iterator n_it, n_end(leaf_nodes.end());
|
||||||
|
|
||||||
n = mesh_.calc_vertex_normal(vh);
|
n = mesh_.calc_vertex_normal(vh);
|
||||||
max_angle = 0.0f;
|
float max_angle = 0.0f;
|
||||||
|
|
||||||
n_it = leaf_nodes.begin();
|
n_it = leaf_nodes.begin();
|
||||||
while( n_it != n_end )
|
while( n_it != n_end )
|
||||||
{
|
{
|
||||||
ln = vhierarchy_.node(*n_it).normal();
|
ln = vhierarchy_.node(*n_it).normal();
|
||||||
angle = acosf( dot(n,ln) );
|
const float angle = acosf( dot(n,ln) );
|
||||||
max_angle = std::max(max_angle, angle );
|
max_angle = std::max(max_angle, angle );
|
||||||
|
|
||||||
++n_it;
|
++n_it;
|
||||||
@@ -844,7 +843,6 @@ compute_screen_space_error(VHierarchyNodeHandle node_handle, VHierarchyNodeHandl
|
|||||||
Mesh::VertexHandle vh;
|
Mesh::VertexHandle vh;
|
||||||
Vec3f residual, res;
|
Vec3f residual, res;
|
||||||
Vec3f lp, tri[3];
|
Vec3f lp, tri[3];
|
||||||
float min_distance;
|
|
||||||
float s, t;
|
float s, t;
|
||||||
VHierarchyNodeHandleContainer::iterator n_it, n_end(leaf_nodes.end());
|
VHierarchyNodeHandleContainer::iterator n_it, n_end(leaf_nodes.end());
|
||||||
|
|
||||||
@@ -855,7 +853,7 @@ compute_screen_space_error(VHierarchyNodeHandle node_handle, VHierarchyNodeHandl
|
|||||||
// compute residual of a leaf-vertex from the current mesh_
|
// compute residual of a leaf-vertex from the current mesh_
|
||||||
vh = vhierarchy_.node(node_handle).vertex_handle();
|
vh = vhierarchy_.node(node_handle).vertex_handle();
|
||||||
residual = lp - mesh_.point(vh);
|
residual = lp - mesh_.point(vh);
|
||||||
min_distance = residual.length();
|
float min_distance = residual.length();
|
||||||
|
|
||||||
for (vf_it=mesh_.vf_iter(vh); vf_it.is_valid(); ++vf_it)
|
for (vf_it=mesh_.vf_iter(vh); vf_it.is_valid(); ++vf_it)
|
||||||
{
|
{
|
||||||
@@ -912,18 +910,16 @@ compute_mue_sigma(VHierarchyNodeHandle node_handle,
|
|||||||
float ratio = std::max(1.0f, max_inner/max_cross);
|
float ratio = std::max(1.0f, max_inner/max_cross);
|
||||||
float whole_degree = acosf(1.0f/ratio);
|
float whole_degree = acosf(1.0f/ratio);
|
||||||
float mue, max_mue;
|
float mue, max_mue;
|
||||||
float degree;
|
|
||||||
float res_length;
|
|
||||||
Vec3f res;
|
Vec3f res;
|
||||||
|
|
||||||
max_mue = 0.0f;
|
max_mue = 0.0f;
|
||||||
for (r_it = residuals.begin(); r_it != r_end; ++r_it)
|
for (r_it = residuals.begin(); r_it != r_end; ++r_it)
|
||||||
{
|
{
|
||||||
res = *r_it;
|
res = *r_it;
|
||||||
res_length = res.length();
|
float res_length = res.length();
|
||||||
|
|
||||||
// TODO: take care when res.length() is too small
|
// TODO: take care when res.length() is too small
|
||||||
degree = acosf(dot(vn,res) / res_length);
|
float degree = acosf(dot(vn,res) / res_length);
|
||||||
|
|
||||||
if (degree < 0.0f) degree = -degree;
|
if (degree < 0.0f) degree = -degree;
|
||||||
if (degree > float(M_PI_2)) degree = float(M_PI) - degree;
|
if (degree > float(M_PI_2)) degree = float(M_PI) - degree;
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ PolyConnectivity::FaceHandle
|
|||||||
PolyConnectivity::add_face(const VertexHandle* _vertex_handles, size_t _vhs_size)
|
PolyConnectivity::add_face(const VertexHandle* _vertex_handles, size_t _vhs_size)
|
||||||
{
|
{
|
||||||
VertexHandle vh;
|
VertexHandle vh;
|
||||||
size_t i, ii, n(_vhs_size), id;
|
size_t i, ii, n(_vhs_size);
|
||||||
HalfedgeHandle inner_next, inner_prev,
|
HalfedgeHandle inner_next, inner_prev,
|
||||||
outer_next, outer_prev,
|
outer_next, outer_prev,
|
||||||
boundary_next, boundary_prev,
|
boundary_next, boundary_prev,
|
||||||
@@ -225,7 +225,7 @@ PolyConnectivity::add_face(const VertexHandle* _vertex_handles, size_t _vhs_size
|
|||||||
assert(inner_prev.is_valid());
|
assert(inner_prev.is_valid());
|
||||||
assert(inner_next.is_valid());
|
assert(inner_next.is_valid());
|
||||||
|
|
||||||
id = 0;
|
size_t id = 0;
|
||||||
if (edgeData_[i].is_new) id |= 1;
|
if (edgeData_[i].is_new) id |= 1;
|
||||||
if (edgeData_[ii].is_new) id |= 2;
|
if (edgeData_[ii].is_new) id |= 2;
|
||||||
|
|
||||||
|
|||||||
@@ -9,13 +9,12 @@ template <typename Mesh>
|
|||||||
bool
|
bool
|
||||||
fill_props( Mesh& _m, OpenMesh::VPropHandleT<float> _ph, bool _check=false)
|
fill_props( Mesh& _m, OpenMesh::VPropHandleT<float> _ph, bool _check=false)
|
||||||
{
|
{
|
||||||
float v;
|
|
||||||
static float a[9] = { 1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f };
|
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();
|
for(typename Mesh::VertexIter it=_m.vertices_begin();
|
||||||
it != _m.vertices_end(); ++it)
|
it != _m.vertices_end(); ++it)
|
||||||
{
|
{
|
||||||
v = a[it->idx()%9];
|
const float v = a[it->idx()%9];
|
||||||
if ( _check && !(_m.property( _ph, it ) == v) )
|
if ( _check && !(_m.property( _ph, it ) == v) )
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
@@ -29,13 +28,11 @@ template <typename Mesh>
|
|||||||
bool
|
bool
|
||||||
fill_props( Mesh& _m, OpenMesh::EPropHandleT<bool> _ph, bool _check=false )
|
fill_props( Mesh& _m, OpenMesh::EPropHandleT<bool> _ph, bool _check=false )
|
||||||
{
|
{
|
||||||
size_t n;
|
|
||||||
bool v;
|
|
||||||
for( typename Mesh::EdgeIter it=_m.edges_begin();
|
for( typename Mesh::EdgeIter it=_m.edges_begin();
|
||||||
it != _m.edges_end(); ++it)
|
it != _m.edges_end(); ++it)
|
||||||
{
|
{
|
||||||
n = it->idx();
|
const size_t n = it->idx();
|
||||||
v = ((n&(n-1))==0); // true for 0,1,2,4,8,..
|
const bool v = ((n&(n-1))==0); // true for 0,1,2,4,8,..
|
||||||
|
|
||||||
if (_check && _m.property( _ph, it ) != v)
|
if (_check && _m.property( _ph, it ) != v)
|
||||||
{
|
{
|
||||||
@@ -58,11 +55,10 @@ template <typename Mesh>
|
|||||||
bool
|
bool
|
||||||
fill_props(Mesh& _m, OpenMesh::FPropHandleT<std::string> _ph, bool _check=false)
|
fill_props(Mesh& _m, OpenMesh::FPropHandleT<std::string> _ph, bool _check=false)
|
||||||
{
|
{
|
||||||
int n;
|
|
||||||
for( typename Mesh::FaceIter it=_m.faces_begin();
|
for( typename Mesh::FaceIter it=_m.faces_begin();
|
||||||
it != _m.faces_end(); ++it)
|
it != _m.faces_end(); ++it)
|
||||||
{
|
{
|
||||||
n = it->idx();
|
const int n = it->idx();
|
||||||
_m.property( _ph, it ) = int2roman(++n);
|
_m.property( _ph, it ) = int2roman(++n);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -73,8 +69,6 @@ template <typename Mesh, typename T>
|
|||||||
bool
|
bool
|
||||||
fill_props( Mesh& _m, OpenMesh::HPropHandleT<T> _ph, bool _check=false)
|
fill_props( Mesh& _m, OpenMesh::HPropHandleT<T> _ph, bool _check=false)
|
||||||
{
|
{
|
||||||
int n;
|
|
||||||
T v;
|
|
||||||
static float a[9] = { 1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f };
|
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 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 c[9] = { 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f, 1.1f, 2.2f };
|
||||||
@@ -85,11 +79,11 @@ fill_props( Mesh& _m, OpenMesh::HPropHandleT<T> _ph, bool _check=false)
|
|||||||
for( typename Mesh::HalfedgeIter it=_m.halfedges_begin();
|
for( typename Mesh::HalfedgeIter it=_m.halfedges_begin();
|
||||||
it != _m.halfedges_end(); ++it)
|
it != _m.halfedges_end(); ++it)
|
||||||
{
|
{
|
||||||
n = it->idx();
|
const int n = it->idx();
|
||||||
|
|
||||||
// v = it->idx()+1; // ival
|
// v = it->idx()+1; // ival
|
||||||
// v = values[n%9]; // dval
|
// v = values[n%9]; // dval
|
||||||
v = ((n&(n-1))==0); // bval
|
T v = ((n&(n-1))==0); // bval
|
||||||
v.vec4fval[0] = a[n%9];
|
v.vec4fval[0] = a[n%9];
|
||||||
v.vec4fval[1] = b[n%9];
|
v.vec4fval[1] = b[n%9];
|
||||||
v.vec4fval[2] = c[n%9];
|
v.vec4fval[2] = c[n%9];
|
||||||
@@ -107,10 +101,9 @@ template <typename Mesh, typename T>
|
|||||||
bool
|
bool
|
||||||
fill_props( Mesh& _m, OpenMesh::MPropHandleT<T> _ph, bool _check=false)
|
fill_props( Mesh& _m, OpenMesh::MPropHandleT<T> _ph, bool _check=false)
|
||||||
{
|
{
|
||||||
size_t idx;
|
|
||||||
for( typename Mesh::FaceIter it=_m.faces_begin(); it != _m.faces_end(); ++it)
|
for( typename Mesh::FaceIter it=_m.faces_begin(); it != _m.faces_end(); ++it)
|
||||||
{
|
{
|
||||||
idx = it->idx();
|
const size_t idx = it->idx();
|
||||||
if ( _check && _m.property( _ph )[int2roman(idx+1)] != idx )
|
if ( _check && _m.property( _ph )[int2roman(idx+1)] != idx )
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ Tvv3<M>::raise(typename M::FaceHandle& _fh, state_t _target_state)
|
|||||||
typename M::Point face_position;
|
typename M::Point face_position;
|
||||||
const typename M::Point zero_point(0.0, 0.0, 0.0);
|
const typename M::Point zero_point(0.0, 0.0, 0.0);
|
||||||
std::vector<typename M::VertexHandle> vertex_vector;
|
std::vector<typename M::VertexHandle> vertex_vector;
|
||||||
int valence(0);
|
|
||||||
|
|
||||||
// raise all adjacent vertices to level x-1
|
// raise all adjacent vertices to level x-1
|
||||||
for (fv_it = Base::mesh_.fv_iter(_fh); fv_it.is_valid(); ++fv_it) {
|
for (fv_it = Base::mesh_.fv_iter(_fh); fv_it.is_valid(); ++fv_it) {
|
||||||
@@ -137,6 +137,8 @@ Tvv3<M>::raise(typename M::FaceHandle& _fh, state_t _target_state)
|
|||||||
|
|
||||||
Base::mesh_.split(_fh, vh);
|
Base::mesh_.split(_fh, vh);
|
||||||
|
|
||||||
|
int valence = 0;
|
||||||
|
|
||||||
// calculate display position for new vertex
|
// calculate display position for new vertex
|
||||||
for (vv_it = Base::mesh_.vv_iter(vh); vv_it.is_valid(); ++vv_it)
|
for (vv_it = Base::mesh_.vv_iter(vh); vv_it.is_valid(); ++vv_it)
|
||||||
{
|
{
|
||||||
@@ -1758,7 +1760,6 @@ EVc<M>::init_coeffs(size_t _max_valence)
|
|||||||
if (coeffs_.size() < _max_valence+1) // less than? add additional valences
|
if (coeffs_.size() < _max_valence+1) // less than? add additional valences
|
||||||
{
|
{
|
||||||
const double _2pi = 2.0*M_PI;
|
const double _2pi = 2.0*M_PI;
|
||||||
double c;
|
|
||||||
|
|
||||||
if (coeffs_.empty())
|
if (coeffs_.empty())
|
||||||
coeffs_.push_back(0.0); // dummy for invalid valences 0,1,2
|
coeffs_.push_back(0.0); // dummy for invalid valences 0,1,2
|
||||||
@@ -1766,7 +1767,7 @@ EVc<M>::init_coeffs(size_t _max_valence)
|
|||||||
for(size_t v=coeffs_.size(); v <= _max_valence; ++v)
|
for(size_t v=coeffs_.size(); v <= _max_valence; ++v)
|
||||||
{
|
{
|
||||||
// ( 3/2 + cos ( 2 PI / valence ) )<29> / 2 - 1
|
// ( 3/2 + cos ( 2 PI / valence ) )<29> / 2 - 1
|
||||||
c = 1.5 + cos( _2pi / v );
|
double c = 1.5 + cos( _2pi / v );
|
||||||
c = c * c * 0.5 - 1.0;
|
c = c * c * 0.5 - 1.0;
|
||||||
coeffs_.push_back(c);
|
coeffs_.push_back(c);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user