diff --git a/vcg/complex/local_optimization/tri_edge_flip.h b/vcg/complex/local_optimization/tri_edge_flip.h index ae4d6af9..b3f188eb 100644 --- a/vcg/complex/local_optimization/tri_edge_flip.h +++ b/vcg/complex/local_optimization/tri_edge_flip.h @@ -170,8 +170,8 @@ public: bool IsUpToDate() { int lastMark = _pos.F()->V(0)->IMark(); - lastMark = vcg::math::Max(lastMark, _pos.F()->V(1)->IMark()); - lastMark = vcg::math::Max(lastMark, _pos.F()->V(2)->IMark()); + lastMark = std::max(lastMark, _pos.F()->V(1)->IMark()); + lastMark = std::max(lastMark, _pos.F()->V(2)->IMark()); return ( _localMark >= lastMark ); } @@ -606,4 +606,4 @@ public: } // end of namespace tri } // end of namespace vcg -#endif \ No newline at end of file +#endif diff --git a/vcg/complex/trimesh/create/extended_marching_cubes.h b/vcg/complex/trimesh/create/extended_marching_cubes.h index e8924196..96c1d2fd 100644 --- a/vcg/complex/trimesh/create/extended_marching_cubes.h +++ b/vcg/complex/trimesh/create/extended_marching_cubes.h @@ -291,7 +291,7 @@ namespace vcg for (i=0; ivert[ vertices_idx[i] ].P(); - normals[i] = _mesh->vert[ vertices_idx[i] ].N(); + normals[i].Import(_mesh->vert[ vertices_idx[i] ].N()); } // move barycenter of points into (0, 0, 0) @@ -329,7 +329,7 @@ namespace vcg if (c < minC) minC = c; if (c > maxC) maxC = c; } - c = vcg::math::Max< double >(fabs(minC), fabs(maxC)); + c = std::max< double >(fabs(minC), fabs(maxC)); c = sqrt(1.0-c*c); rank = (c > cos(_featureAngle) ? 2 : 3); @@ -354,7 +354,7 @@ namespace vcg { double smin = DBL_MAX; // the max value, as defined in unsigned int sminid = 0; - unsigned int srank = vcg::math::Min< unsigned int >(vertices_num, 3u); + unsigned int srank = std::min< unsigned int >(vertices_num, 3u); for (i=0; i(1.0,sqrt( (b- a* d_pw1)/d_curr))); + alpha_ = 2*acos ( std::min(1.0,sqrt( (b- a* d_pw1)/d_curr))); if ( alpha+alpha_ > M_PI){ curr_d = d_curr + ew_c; }else { - beta_ = 2*acos ( math::Min(1.0,sqrt( (b- a* d_curr)/d_pw1))); + beta_ = 2*acos ( std::min(1.0,sqrt( (b- a* d_curr)/d_pw1))); beta = acos((w_w1).dot(-w1_c)/(ew_w1*ec_w1)); if ( beta+beta_ > M_PI) diff --git a/vcg/complex/trimesh/point_sampling.h b/vcg/complex/trimesh/point_sampling.h index 764c120a..880da99c 100644 --- a/vcg/complex/trimesh/point_sampling.h +++ b/vcg/complex/trimesh/point_sampling.h @@ -1169,9 +1169,9 @@ static void PoissonDiskPruning(MetroMesh &origMesh, VertexSampler &ps, MetroMesh // inflating origMesh.bbox.Offset(cellsize); - int sizeX = vcg::math::Max(1.0f,origMesh.bbox.DimX() / cellsize); - int sizeY = vcg::math::Max(1.0f,origMesh.bbox.DimY() / cellsize); - int sizeZ = vcg::math::Max(1.0f,origMesh.bbox.DimZ() / cellsize); + int sizeX = std::max(1.0f,origMesh.bbox.DimX() / cellsize); + int sizeY = std::max(1.0f,origMesh.bbox.DimY() / cellsize); + int sizeZ = std::max(1.0f,origMesh.bbox.DimZ() / cellsize); Point3i gridsize(sizeX, sizeY, sizeZ); #ifdef QT_VERSION qDebug("PDS: radius %f Grid:(%i %i %i) ",diskRadius,sizeX,sizeY,sizeZ); @@ -1256,9 +1256,9 @@ static void PoissonDisk(MetroMesh &origMesh, VertexSampler &ps, MetroMesh &monte // inflating origMesh.bbox.Offset(cellsize); - int sizeX = vcg::math::Max(1.0f,origMesh.bbox.DimX() / cellsize); - int sizeY = vcg::math::Max(1.0f,origMesh.bbox.DimY() / cellsize); - int sizeZ = vcg::math::Max(1.0f,origMesh.bbox.DimZ() / cellsize); + int sizeX = std::max(1.0f,origMesh.bbox.DimX() / cellsize); + int sizeY = std::max(1.0f,origMesh.bbox.DimY() / cellsize); + int sizeZ = std::max(1.0f,origMesh.bbox.DimZ() / cellsize); Point3i gridsize(sizeX, sizeY, sizeZ); #ifdef QT_VERSION qDebug("PDS: radius %f Grid:(%i %i %i) ",diskRadius,sizeX,sizeY,sizeZ); diff --git a/vcg/complex/trimesh/update/color.h b/vcg/complex/trimesh/update/color.h index 2b7a7046..a8040a31 100644 --- a/vcg/complex/trimesh/update/color.h +++ b/vcg/complex/trimesh/update/color.h @@ -435,10 +435,8 @@ static int Thresholding(UpdateMeshType &m, float threshold, Color4b c1 = Color4< //Computes the lightness value for a specified color. lightness = 0.5*(Max(R,G,B)+Min(R,G,B)) static float ComputeLightness(Color4b c) { - float min_rgb = math::Min((float)c[0],(float)c[1]); - min_rgb = math::Min(min_rgb,(float)c[2]); - float max_rgb = math::Max((float)c[0],(float)c[1]); - max_rgb = math::Max(max_rgb,(float)c[2]); + float min_rgb = (float)math::Min(c[0],c[1],c[2]); + float max_rgb = (float)math::Max(c[0],c[1],c[2]); return (max_rgb + min_rgb)/2; } @@ -749,8 +747,8 @@ static int Equalize(UpdateMeshType &m, unsigned int rgbMask, const bool ProcessS { if(!ProcessSelected || (*vi).IsS()) //if this vertex has been selected, put it in the histograms { - int v = (int)(ComputeLightness((*vi).C())+0.5); //compute and round lightness value - Hl.Add(v); Hr.Add((*vi).C()[0]); Hg.Add((*vi).C()[1]); Hb.Add((*vi).C()[2]); + float v = ComputeLightness((*vi).C())+0.5; //compute and round lightness value + Hl.Add(v); Hr.Add((float)(*vi).C()[0]); Hg.Add((float)(*vi).C()[1]); Hb.Add((float)(*vi).C()[2]); } } } diff --git a/vcg/complex/trimesh/update/curvature.h b/vcg/complex/trimesh/update/curvature.h index 4008044e..d63d015e 100644 --- a/vcg/complex/trimesh/update/curvature.h +++ b/vcg/complex/trimesh/update/curvature.h @@ -634,7 +634,7 @@ public: Point3 n1 = p.F()->cN();n1.Normalize(); Point3 n2 = p.FFlip()->cN();n2.Normalize(); ScalarType n1n2 = (n1 ^ n2).dot(normalized_edge); - n1n2 = math::Max(math::Min ( 1.0,n1n2),-1.0); + n1n2 = std::max(std::min( ScalarType(1.0),n1n2),ScalarType(-1.0)); ScalarType beta = math::Asin(n1n2); m33[0][0] += beta*edge_length*normalized_edge[0]*normalized_edge[0]; m33[0][1] += beta*edge_length*normalized_edge[1]*normalized_edge[0]; diff --git a/vcg/math/lin_algebra.h b/vcg/math/lin_algebra.h index 0d92e04b..2d9d546b 100644 --- a/vcg/math/lin_algebra.h +++ b/vcg/math/lin_algebra.h @@ -336,7 +336,7 @@ namespace vcg A[i][k] *= scale; } } - anorm=math::Max( anorm, (math::Abs(W[i])+math::Abs(rv1[i])) ); + anorm=std::max( anorm, (math::Abs(W[i])+math::Abs(rv1[i])) ); } // Accumulation of right-hand transformations. for (i=(n-1); i>=0; i--) @@ -364,7 +364,7 @@ namespace vcg l = i; } // Accumulation of left-hand transformations. - for (i=math::Min(m,n)-1; i>=0; i--) + for (i=std::min(m,n)-1; i>=0; i--) { l = i+1; g = W[i]; diff --git a/vcg/simplex/face/distance.h b/vcg/simplex/face/distance.h index 0a6e0cab..1dd3f548 100644 --- a/vcg/simplex/face/distance.h +++ b/vcg/simplex/face/distance.h @@ -184,7 +184,7 @@ namespace vcg { if(dist>b2) { dist = b2; return true; } else return false; } - if( (b=vcg::math::Min(b0,vcg::math::Min(b1,b2))) < EPS*DoubleArea(f)) + if( (b=math::Min(b0,b1,b2)) < EPS*DoubleArea(f)) { ScalarType bt; if(b==b0) bt = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p); @@ -220,7 +220,7 @@ namespace vcg { if(dist>b2) { dist = b2; return true; } else return false; } - if( (b=vcg::math::Min(b0,vcg::math::Min(b1,b2))) < EPS*DoubleArea(f)) + if( (b=math::Min(b0,b1,b2)) < EPS*DoubleArea(f)) { ScalarType bt; if(b==b0) bt = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p); @@ -406,7 +406,7 @@ namespace vcg { // vicini (come prodotto vettore) // Nota: si potrebbe rendere un pochino piu' veloce sostituendo Area() // con il prodotto vettore dei due edge in 2d lungo il piano migliore. - if( (b=vcg::math::Min(b0,vcg::math::Min(b1,b2))) < EPS*DoubleArea(f)) + if( (b=vcg::math::Min(b0,b1,b2)) < EPS*DoubleArea(f)) { ScalarType bt; if(b==b0) bt = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p); @@ -443,7 +443,7 @@ namespace vcg { if(dist>b2) { dist = b2; return true; } else return false; } - if( (b=vcg::math::Min(b0,vcg::math::Min(b1,b2))) < EPS*DoubleArea(f)) + if( (b=vcg::math::Min(b0,b1,b2)) < EPS*DoubleArea(f)) { ScalarType bt; if(b==b0) bt = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p); @@ -480,7 +480,7 @@ namespace vcg { if(dist>b2) { dist = b2; return true; } else return false; } - if( (b=vcg::math::Min(b0,vcg::math::Min(b1,b2))) < EPS*DoubleArea(f)) + if( (b=vcg::math::Min(b0,b1,b2)) < EPS*DoubleArea(f)) { ScalarType bt; if(b==b0) bt = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p); diff --git a/vcg/space/index/grid_util.h b/vcg/space/index/grid_util.h index ce307747..a2216dbe 100644 --- a/vcg/space/index/grid_util.h +++ b/vcg/space/index/grid_util.h @@ -287,9 +287,9 @@ void BestDim( const Box3 box, const scalar_type voxel_size, Point3i else if(size[2]>eps) dim[2] = int(ncell); } - dim[0] = math::Max(dim[0],1); - dim[1] = math::Max(dim[1],1); - dim[2] = math::Max(dim[2],1); + dim[0] = std::max(dim[0],1); + dim[1] = std::max(dim[1],1); + dim[2] = std::max(dim[2],1); } } #endif diff --git a/vcg/space/index/octree.h b/vcg/space/index/octree.h index 106cfa6e..1c37319e 100644 --- a/vcg/space/index/octree.h +++ b/vcg/space/index/octree.h @@ -249,7 +249,7 @@ public: CoordType offset = bounding_box.Dim()*Octree::EXPANSION_FACTOR; CoordType center = bounding_box.Center(); resulting_bb.Offset(offset); - ScalarType longest_side = vcg::math::Max( resulting_bb.DimX(), vcg::math::Max(resulting_bb.DimY(), resulting_bb.DimZ()) )/2.0f; + ScalarType longest_side = vcg::math::Max( resulting_bb.DimX(), resulting_bb.DimY(), resulting_bb.DimZ())/2.0f; resulting_bb.Set(center); resulting_bb.Offset(longest_side); TemplatedOctree::boundingBox = resulting_bb; @@ -428,7 +428,7 @@ OBJECT_RETRIEVER: NeighbourIterator first = neighbors.begin(); NeighbourIterator last = neighbors.end(); - object_count = vcg::math::Min(k, object_count); + object_count = std::min(k, object_count); if (sort_per_distance) std::partial_sort< NeighbourIterator >(first, first+object_count, last ); else std::nth_element < NeighbourIterator >(first, first+object_count, last ); diff --git a/vcg/space/intersection3.h b/vcg/space/intersection3.h index ee2d1e19..5a9d32e9 100644 --- a/vcg/space/intersection3.h +++ b/vcg/space/intersection3.h @@ -224,7 +224,7 @@ namespace vcg { int solution_count = 0; if (ScalarType(0.0)<=lambda1 && lambda1<=ScalarType(1.0)) { - ScalarType t_enter = vcg::math::Max< ScalarType >(lambda1, ScalarType(0.0)); + ScalarType t_enter = std::max< ScalarType >(lambda1, ScalarType(0.0)); t0 = segment.P0() + r*t_enter; solution_count++; } @@ -232,7 +232,7 @@ namespace vcg { if (ScalarType(0.0)<=lambda2 && lambda2<=ScalarType(1.0)) { Point3t *pt = (solution_count>0) ? &t1 : &t0; - ScalarType t_exit = vcg::math::Min< ScalarType >(lambda2, ScalarType(1.0)); + ScalarType t_exit = std::min< ScalarType >(lambda2, ScalarType(1.0)); *pt = segment.P0() + r*t_exit; solution_count++; } @@ -325,8 +325,8 @@ namespace vcg { if (res!=NULL) { ScalarType witness_norm = witness.Norm(); - res->first = vcg::math::Max< ScalarType >( witness_norm-radius, ScalarType(0.0) ); - res->second = vcg::math::Max< ScalarType >( radius-witness_norm, ScalarType(0.0) ); + res->first = std::max< ScalarType >( witness_norm-radius, ScalarType(0.0) ); + res->second = std::max< ScalarType >( radius-witness_norm, ScalarType(0.0) ); } penetration_detected = (witness.SquaredNorm() <= (radius*radius)); witness += center; diff --git a/vcg/space/normal_extrapolation.h b/vcg/space/normal_extrapolation.h index ccc1a2da..0d568ddd 100644 --- a/vcg/space/normal_extrapolation.h +++ b/vcg/space/normal_extrapolation.h @@ -316,7 +316,7 @@ namespace vcg //std::advance((iSonVertex=begin), *iSon);//retrieve the pointer to the Vertex associated to son border.push( *iSon ); } - maxSize = vcg::math::Max(maxSize, queueSize); + maxSize = std::max(maxSize, queueSize); } } } @@ -341,7 +341,7 @@ namespace vcg if (current_node->vertex->N().dot(current_node->sons[s]->vertex->N())sons[s]->vertex->N() *= ScalarType(-1.0f); border.push( current_node->sons[s] ); - maxSize = vcg::math::Max(maxSize, queueSize); + maxSize = std::max(maxSize, queueSize); } } } diff --git a/wrap/gui/coordinateframe.cpp b/wrap/gui/coordinateframe.cpp index ab0477a9..375a8d83 100644 --- a/wrap/gui/coordinateframe.cpp +++ b/wrap/gui/coordinateframe.cpp @@ -188,10 +188,8 @@ float CoordinateFrame::calcSlope(const Point3d &a,const Point3d &b,float dim,int float tickNum = spacing/Distance(p2,p1);// pxl spacing float slope = dim*tickNum; - float nslope = math::Min( - math::Min(niceRound(slope), 0.5f*niceRound(2.0f*slope)), - 0.2f*niceRound(5.0f*slope)); - nslope = math::Max(niceRound(dim*.001f),nslope); // prevent too small slope + float nslope = math::Min(niceRound(slope), 0.5f*niceRound(2.0f*slope), 0.2f*niceRound(5.0f*slope)); + nslope = std::max(niceRound(dim*.001f),nslope); // prevent too small slope return nslope; }