Skip to content

Commit

Permalink
Fixes for min/max
Browse files Browse the repository at this point in the history
  • Loading branch information
maxGimeno committed Apr 21, 2020
1 parent f0db548 commit e9d41d7
Show file tree
Hide file tree
Showing 84 changed files with 245 additions and 245 deletions.
10 changes: 5 additions & 5 deletions AABB_tree/demo/AABB_tree/Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -855,8 +855,8 @@ void Scene::update_grid_size()
}

void Scene::generate_points_in(const unsigned int nb_points,
const double min,
const double max)
const double vmin,
const double vmax)
{
if(m_pPolyhedron == NULL)
{
Expand All @@ -875,7 +875,7 @@ void Scene::generate_points_in(const unsigned int nb_points,
CGAL::Timer timer;
timer.start();
std::cout << "Generate " << nb_points << " points in interval ["
<< min << ";" << max << "]";
<< vmin << ";" << vmax << "]";

unsigned int nb_trials = 0;
Vector vec = random_vector();
Expand All @@ -892,8 +892,8 @@ void Scene::generate_points_in(const unsigned int nb_points,
if(nb_intersections % 2 != 0)
signed_distance *= -1.0;

if(signed_distance >= min &&
signed_distance <= max)
if(signed_distance >= vmin &&
signed_distance <= vmax)
{
m_points.push_back(p);
if(m_points.size()%(nb_points/10) == 0)
Expand Down
2 changes: 1 addition & 1 deletion AABB_tree/demo/AABB_tree/Scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class Scene : public QObject
void generate_boundary_points(const unsigned int nb_points);
void generate_boundary_segments(const unsigned int nb_slices);
void generate_points_in(const unsigned int nb_points,
const double min, const double max);
const double vmin, const double vmax);

// algorithms/refine
void refine_loop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ QRectF ArrangementDemoGraphicsView::getViewportRect( ) const
QPointF p1 = this->mapToScene( 0, 0 );
QPointF p2 = this->mapToScene( this->width( ), this->height( ) );

double xmin = std::min( p1.x( ), p2.x( ) );
double xmax = std::max( p1.x( ), p2.x( ) );
double ymin = std::min( p1.y( ), p2.y( ) );
double ymax = std::max( p1.y( ), p2.y( ) );
double xmin = (std::min)( p1.x( ), p2.x( ) );
double xmax = (std::max)( p1.x( ), p2.x( ) );
double ymin = (std::min)( p1.y( ), p2.y( ) );
double ymax = (std::max)( p1.y( ), p2.y( ) );

QRectF res = QRectF( QPointF( xmin, ymin ), QPointF( xmax, ymax ) );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3024,8 +3024,8 @@ class Arc_2 :
y_dapprox = y_interval_for_curve_end(*this, CGAL::ARR_MIN_END, prec);

// adapt y-interval
ymin = CGAL::min(ymin, y_dapprox.first);
ymax = CGAL::max(ymax, y_dapprox.second);
ymin = (CGAL::min)(ymin, y_dapprox.first);
ymax = (CGAL::max)(ymax, y_dapprox.second);

// right end

Expand Down Expand Up @@ -3105,9 +3105,9 @@ class Arc_2 :
(curr_xy, prec);

// adapt y-interval
ymin = CGAL::min(ymin,
ymin = (CGAL::min)(ymin,
CGAL::to_double(xy_approx.first));
ymax = CGAL::max(ymax,
ymax = (CGAL::max)(ymax,
CGAL::to_double(xy_approx.second));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ void draw(const Arc_2& arc,
ref_bound = engine.pixel_h_r/CGAL_REFINE_X;

#ifdef CGAL_CKVA_RENDER_WITH_REFINEMENT
ref_bound = std::min(ref_bound, Rational(CGAL_REFINE_DOUBLE_APPROX));
ref_bound = (std::min)(ref_bound, Rational(CGAL_REFINE_DOUBLE_APPROX));
#endif
Gfx_OUT("computing y-coordinates\n");

Expand Down Expand Up @@ -912,7 +912,7 @@ bool draw(const Point_2& pt, Coord_2& coord) {
const Coordinate_1& x0 = pt.x();
Rational ref_bound = engine.pixel_w_r / 2;
#ifdef CGAL_CKVA_RENDER_WITH_REFINEMENT
ref_bound = std::min(ref_bound, Rational(CGAL_REFINE_DOUBLE_APPROX));
ref_bound = (std::min)(ref_bound, Rational(CGAL_REFINE_DOUBLE_APPROX));
#endif

typename Curve_kernel_2::Algebraic_kernel_d_1::Approximate_relative_1
Expand All @@ -932,7 +932,7 @@ bool draw(const Point_2& pt, Coord_2& coord) {
ref_bound = engine.pixel_h_r / CGAL_REFINE_X;

#ifdef CGAL_CKVA_RENDER_WITH_REFINEMENT
ref_bound = std::min(ref_bound, Rational(CGAL_REFINE_DOUBLE_APPROX));
ref_bound = (std::min)(ref_bound, Rational(CGAL_REFINE_DOUBLE_APPROX));
#endif

Coordinate_2 xy(x0, pt.curve(), pt.arcno());
Expand Down
2 changes: 1 addition & 1 deletion BGL/include/CGAL/boost/graph/selection.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ struct Regularization_graph
if (get(pmap.rg->is_selected_map, fd))
{
if (pmap.rg->prevent_unselection)
out[0] = std::numeric_limits<double>::max();
out[0] = (std::numeric_limits<double>::max)();
else
out[0] = value;
out[1] = 0.;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ int nr = 0;

double rerr(double exact,double approx) {
const double e = std::abs((exact-approx)/exact);
mine = std::min(mine,e);
maxe = std::max(maxe,e);
mine = (std::min)(mine,e);
maxe = (std::max)(maxe,e);
avge += e;
++nr;
return e;
Expand Down
2 changes: 1 addition & 1 deletion CGAL_ipelets/demo/CGAL_ipelets/alpha_shapes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void ASphapeIpelet::protected_run(int fn)
}


A.set_alpha(alpha==0?std::max(std::numeric_limits<double>::epsilon(),A.get_nth_alpha(0)/2.):
A.set_alpha(alpha==0?(std::max)(std::numeric_limits<double>::epsilon(),A.get_nth_alpha(0)/2.):
(std::size_t) alpha==A.number_of_alphas()?A.get_nth_alpha(alpha-1)+1:A.get_nth_alpha(alpha-1)/2.+A.get_nth_alpha(alpha)/2.);
for ( Alpha_shape_2::Alpha_shape_edges_iterator it=A.alpha_shape_edges_begin();it!=A.alpha_shape_edges_end();++it)
draw_in_ipe(A.segment(*it));
Expand Down
2 changes: 1 addition & 1 deletion CGAL_ipelets/demo/CGAL_ipelets/skeleton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void SkeletonIpelet::protected_run(int fn)
std::list<double> offsets;
//~ "Interior skeleton", "Exterior skeleton","Interior offset","Exterior offset","Interior offsets","Exterior offsets", "Help"
SkeletonPtr ss;
double max_edge=std::max((bbox.xmax()-bbox.xmin()),(bbox.ymax()-bbox.ymin()));
double max_edge=(std::max)((bbox.xmax()-bbox.xmin()),(bbox.ymax()-bbox.ymin()));
double dist=0.;
int ret_val=-1;
switch(fn){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ class Cluster_vertical_extent : public CGAL::Classification::Feature_base
m_values.reserve (clusters.size());
for (std::size_t i = 0; i < clusters.size(); ++ i)
{
float min_z = std::numeric_limits<float>::max();
float max_z = -std::numeric_limits<float>::min();
float min_z = (std::numeric_limits<float>::max)();
float max_z = -(std::numeric_limits<float>::min)();

for (std::size_t j = 0; j < clusters[i].size(); ++ j)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class Elevation : public Feature_base
Image_float dem(grid.width(),grid.height());

z_max = 0.f;
z_min = std::numeric_limits<float>::max();
z_min = (std::numeric_limits<float>::max)();

for (std::size_t j = 0; j < grid.height(); ++ j)
for (std::size_t i = 0; i < grid.width(); ++ i)
Expand All @@ -100,8 +100,8 @@ class Elevation : public Feature_base
for (typename Grid::iterator it = grid.indices_begin(i,j); it != end; ++ it)
{
float z = float(get(point_map, *(input.begin()+(*it))).z());
z_min = (std::min(z_min, z));
z_max = (std::max(z_max, z));
z_min = ((std::min)(z_min, z));
z_max = ((std::max)(z_max, z));
mean += z;
++ nb;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ class Height_above : public Feature_base
for (std::size_t i = 0; i < grid.width(); ++ i)
if (grid.has_points(i,j))
{
float z_max = -std::numeric_limits<float>::max();
float z_max = -(std::numeric_limits<float>::max)();

typename Grid::iterator end = grid.indices_end(i,j);
for (typename Grid::iterator it = grid.indices_begin(i,j); it != end; ++ it)
{
float z = float(get(point_map, *(input.begin()+(*it))).z());
z_max = (std::max(z_max, z));
z_max = ((std::max)(z_max, z));
}

dtm(i,j) = z_max;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ class Height_below : public Feature_base
for (std::size_t i = 0; i < grid.width(); ++ i)
if (grid.has_points(i,j))
{
float z_min = std::numeric_limits<float>::max();
float z_min = (std::numeric_limits<float>::max)();

typename Grid::iterator end = grid.indices_end(i,j);
for (typename Grid::iterator it = grid.indices_begin(i,j); it != end; ++ it)
{
float z = float(get(point_map, *(input.begin()+(*it))).z());
z_min = (std::min(z_min, z));
z_min = ((std::min)(z_min, z));
}

dtm(i,j) = z_min;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ class Vertical_range : public Feature_base
for (std::size_t i = 0; i < grid.width(); ++ i)
if (grid.has_points(i,j))
{
float z_max = -std::numeric_limits<float>::max();
float z_min = std::numeric_limits<float>::max();
float z_max = -(std::numeric_limits<float>::max)();
float z_min = (std::numeric_limits<float>::max)();

typename Grid::iterator end = grid.indices_end(i,j);
for (typename Grid::iterator it = grid.indices_begin(i,j); it != end; ++ it)
{
float z = float(get(point_map, *(input.begin()+(*it))).z());
z_max = (std::max(z_max, z));
z_min = (std::min(z_min, z));
z_max = ((std::max)(z_max, z));
z_min = ((std::min)(z_min, z));
}

dtm(i,j) = z_max - z_min;
Expand Down
8 changes: 4 additions & 4 deletions Classification/include/CGAL/Classification/compressed_float.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ typedef unsigned short compressed_float;
typedef unsigned char compressed_float;
# endif

inline compressed_float compress_float (const float& f, const float& min = 0.f, const float& max = 1.f)
inline compressed_float compress_float (const float& f, const float& fmin = 0.f, const float& fmax = 1.f)
{
return static_cast<compressed_float>
(float(std::numeric_limits<compressed_float>::max()) * (f - min) / (max - min));
(float((std::numeric_limits<compressed_float>::max)()) * (f - fmin) / (fmax - fmin));
}

inline float decompress_float (const compressed_float& t, const float& min = 0.f, const float& max = 1.f)
inline float decompress_float (const compressed_float& t, const float& fmin = 0.f, const float& fmax = 1.f)
{
return ((max - min) * (t / float(std::numeric_limits<compressed_float>::max())) + min);
return ((fmax - fmin) * (t / float((std::numeric_limits<compressed_float>::max)())) + fmin);
}

#endif
Expand Down
6 changes: 3 additions & 3 deletions Combinatorial_map/include/CGAL/Combinatorial_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -2631,7 +2631,7 @@ namespace CGAL {
while (beta<1>(dd1)!=d2)
{
if (this->template is_free<2>(beta<1>(dd1)))
{ return std::numeric_limits<std::size_t>::max(); }
{ return (std::numeric_limits<std::size_t>::max)(); }

++res;
dd1=beta<1, 2>(dd1);
Expand All @@ -2653,7 +2653,7 @@ namespace CGAL {
if (d2==beta<2>(d1)) { return 0; }

if (this->template is_free<2>(d1) || this->template is_free<2>(d2))
{ return std::numeric_limits<std::size_t>::max(); }
{ return (std::numeric_limits<std::size_t>::max)(); }

d1=beta<2>(d1);
d2=beta<2>(d2);
Expand All @@ -2662,7 +2662,7 @@ namespace CGAL {
while (beta<0>(dd1)!=d2)
{
if (this->template is_free<2>(beta<0>(dd1)))
{ return std::numeric_limits<std::size_t>::max(); }
{ return (std::numeric_limits<std::size_t>::max)(); }

++res;
dd1=beta<0, 2>(dd1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class Side_of_bounded_circle_3
if (maxz < arz) maxz = arz;
if (maxz < atz) maxz = atz;

double d = std::max(maxx, std::max(maxy, maxz));
double d = (std::max)(maxx, (std::max)(maxy, maxz));
double eps = 3.27418e-11 * d * d * d * d * d * d;

if (det > eps) return ON_BOUNDED_SIDE;
Expand Down
6 changes: 3 additions & 3 deletions Generalized_map/include/CGAL/Generalized_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -1734,7 +1734,7 @@ namespace CGAL {
while (next(dd1)!=d2)
{
if (this->template is_free<2>(next(dd1)))
{ return std::numeric_limits<std::size_t>::max(); }
{ return (std::numeric_limits<std::size_t>::max)(); }

++res;
dd1=opposite2(next(dd1));
Expand All @@ -1755,7 +1755,7 @@ namespace CGAL {
if (d2==opposite2(d1)) { return 0; }

if (this->template is_free<2>(d1) || this->template is_free<2>(d2))
{ return std::numeric_limits<std::size_t>::max(); }
{ return (std::numeric_limits<std::size_t>::max)(); }

d1=opposite2(d1);
d2=opposite2(d2);
Expand All @@ -1764,7 +1764,7 @@ namespace CGAL {
while (previous(dd1)!=d2)
{
if (this->template is_free<2>(previous(dd1)))
{ return std::numeric_limits<std::size_t>::max(); }
{ return (std::numeric_limits<std::size_t>::max)(); }

++res;
dd1=opposite2(previous(dd1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ int main(int argc, char* argv[])
Point_3 sp = tm.point(source);

std::cout << "source: " << sp << " " << source << std::endl;
vertex_descriptor far;
vertex_descriptor vfar;
double sdistance = 0;

for(vertex_descriptor vd : vertices(tm)){
std::cout << vd << " is at distance " << get(vertex_distance, vd) << " to " << source << std::endl;
if(get(vertex_distance, vd) > sdistance){
far = vd;
vfar = vd;
sdistance = get(vertex_distance, vd);
}
}

std::cout << "far: " << tm.point(far) << " " << far << std::endl;
std::cout << "vfar: " << tm.point(vfar) << " " << vfar << std::endl;

hm.add_source(far);
hm.add_source(vfar);
hm.estimate_geodesic_distances(vertex_distance);

for(vertex_descriptor vd : vertices(tm)){
Expand Down
6 changes: 3 additions & 3 deletions Heat_method_3/test/Heat_method_3/heat_method_concept.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ int main()

//Point_3 sp = sm.point(source);

vertex_descriptor far;
vertex_descriptor vfar;
// double sdistance = 0;

for(vertex_descriptor vd : vertices(sm)){
std::cout << vd << " is at distance " << get(heat_intensity, vd) << " from " << source << std::endl;
/*
if(squared_distance(sp,sm.point(vd)) > sdistance){
far = vd;
vfar = vd;
sdistance = squared_distance(sp,sm.point(vd));
}
*/
}
hm.add_source(far);
hm.add_source(vfar);
hm.estimate_geodesic_distances(heat_intensity);

for(vertex_descriptor vd : vertices(sm)){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ int main(int argc, char* argv[])
Point_3 sp = sm.point(source);

std::cout << "source: " << sp << " " << source << std::endl;
vertex_descriptor far;
vertex_descriptor vfar;
double sdistance = 0;

for(vertex_descriptor vd : vertices(sm)){
if(get(vertex_distance,vd) > sdistance){
far = vd;
vfar = vd;
sdistance = get(vertex_distance,vd);
}
}
assert(sdistance > 2.9);
assert(sdistance < CGAL_PI);

hm.add_source(far);
hm.add_source(vfar);
assert(hm.sources().size() == 2);
hm.estimate_geodesic_distances(vertex_distance);

Expand All @@ -62,15 +62,15 @@ int main(int argc, char* argv[])
assert(sdistance > 1.4);
assert(sdistance < CGAL_PI/2.0);

hm.remove_source(far);
hm.remove_source(vfar);
assert(hm.sources().size() == 1);

hm.clear_sources();

// add range of sources
std::vector<vertex_descriptor> vrange;
vrange.push_back(source);
vrange.push_back(far);
vrange.push_back(vfar);
hm.add_sources(vrange);
assert(hm.sources().size() == 2);
hm.estimate_geodesic_distances(vertex_distance);
Expand Down
Loading

0 comments on commit e9d41d7

Please sign in to comment.