mirror of https://github.com/CGAL/cgal
fix protection against min/max macros
The regular expression I used was: ``` ((?!(?:^.*(\/\/|\/\*).*|^ *\* .*|^[^"]*"(?:"[^"]*"|[^"])*))^(?:.*[ ,\(]|))(\b(?:(?:[A-Za-z]+::)*)(?:max|min))\b *\( ```
This commit is contained in:
parent
1f70e59210
commit
d4e6ffddf4
|
|
@ -75,7 +75,7 @@ double mean_min_angle(const Mesh& mesh)
|
||||||
const Triangle_3 tr = surface_mesh_face_to_triangle(f, mesh);
|
const Triangle_3 tr = surface_mesh_face_to_triangle(f, mesh);
|
||||||
std::array<FT, 3> angles = triangle_angles(tr);
|
std::array<FT, 3> angles = triangle_angles(tr);
|
||||||
|
|
||||||
FT min_angle = std::min({angles[0], angles[1], angles[2]});
|
FT min_angle = (std::min)({angles[0], angles[1], angles[2]});
|
||||||
|
|
||||||
min_angle = min_angle * (180.0 / CGAL_PI);
|
min_angle = min_angle * (180.0 / CGAL_PI);
|
||||||
mean_min_angle += min_angle;
|
mean_min_angle += min_angle;
|
||||||
|
|
@ -93,7 +93,7 @@ double mean_max_angle(const Mesh& mesh)
|
||||||
const Triangle_3 tr = surface_mesh_face_to_triangle(f, mesh);
|
const Triangle_3 tr = surface_mesh_face_to_triangle(f, mesh);
|
||||||
std::array<FT, 3> angles = triangle_angles(tr);
|
std::array<FT, 3> angles = triangle_angles(tr);
|
||||||
|
|
||||||
FT max_angle = std::max({angles[0], angles[1], angles[2]});
|
FT max_angle = (std::max)({angles[0], angles[1], angles[2]});
|
||||||
|
|
||||||
max_angle = max_angle * (180.0 / CGAL_PI);
|
max_angle = max_angle * (180.0 / CGAL_PI);
|
||||||
mean_max_angle += max_angle;
|
mean_max_angle += max_angle;
|
||||||
|
|
@ -151,8 +151,8 @@ double mean_edge_ratio(const Mesh& mesh,
|
||||||
FT a = std::sqrt(CGAL::squared_distance(tr[0], tr[1]));
|
FT a = std::sqrt(CGAL::squared_distance(tr[0], tr[1]));
|
||||||
FT b = std::sqrt(CGAL::squared_distance(tr[1], tr[2]));
|
FT b = std::sqrt(CGAL::squared_distance(tr[1], tr[2]));
|
||||||
FT c = std::sqrt(CGAL::squared_distance(tr[2], tr[0]));
|
FT c = std::sqrt(CGAL::squared_distance(tr[2], tr[0]));
|
||||||
FT min_edge = std::min({a, b, c});
|
FT min_edge = (std::min)({a, b, c});
|
||||||
FT max_edge = std::max({a, b, c});
|
FT max_edge = (std::max)({a, b, c});
|
||||||
FT edge_ratio = max_edge / min_edge;
|
FT edge_ratio = max_edge / min_edge;
|
||||||
|
|
||||||
mean_edge_ratio += edge_ratio;
|
mean_edge_ratio += edge_ratio;
|
||||||
|
|
@ -181,7 +181,7 @@ double mean_aspect_ratio(const Mesh& mesh,
|
||||||
FT c = std::sqrt(CGAL::squared_distance(tr[2], tr[0]));
|
FT c = std::sqrt(CGAL::squared_distance(tr[2], tr[0]));
|
||||||
FT s = 0.5 * (a + b + c);
|
FT s = 0.5 * (a + b + c);
|
||||||
FT inscribed_radius = std::sqrt((s * (s - a) * (s - b) * (s - c)) / s);
|
FT inscribed_radius = std::sqrt((s * (s - a) * (s - b) * (s - c)) / s);
|
||||||
FT max_edge = std::max({a, b, c});
|
FT max_edge = (std::max)({a, b, c});
|
||||||
FT aspect_ratio = max_edge / inscribed_radius;
|
FT aspect_ratio = max_edge / inscribed_radius;
|
||||||
aspect_ratio /= (2. * std::sqrt(3.)); // normalized
|
aspect_ratio /= (2. * std::sqrt(3.)); // normalized
|
||||||
mean_aspect_ratio += aspect_ratio;
|
mean_aspect_ratio += aspect_ratio;
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ void GUI_country_pick_handler::mouse_press_event(QMouseEvent* e) {
|
||||||
auto sd = sqrt(d);
|
auto sd = sqrt(d);
|
||||||
auto t1 = (-b - sd) / (2 * a);
|
auto t1 = (-b - sd) / (2 * a);
|
||||||
auto t2 = (-b + sd) / (2 * a);
|
auto t2 = (-b + sd) / (2 * a);
|
||||||
if (t1 > 0 && t2 > 0) ti = std::min(t1, t2);
|
if (t1 > 0 && t2 > 0) ti = (std::min)(t1, t2);
|
||||||
else if (t1 > 0) ti = t1;
|
else if (t1 > 0) ti = t1;
|
||||||
else ti = t2;
|
else ti = t2;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ void Main_widget::initializeGL() {
|
||||||
for (auto& [country_name, triangle_points] : country_triangles_map) {
|
for (auto& [country_name, triangle_points] : country_triangles_map) {
|
||||||
auto country_triangles = std::make_unique<Triangles>(triangle_points);
|
auto country_triangles = std::make_unique<Triangles>(triangle_points);
|
||||||
auto color = QVector4D(rndm(), rndm(), rndm(), 1);
|
auto color = QVector4D(rndm(), rndm(), rndm(), 1);
|
||||||
auto m = std::max(color.x(), std::max(color.y(), color.z()));
|
auto m = (std::max)(color.x(), (std::max)(color.y(), color.z()));
|
||||||
color /= m;
|
color /= m;
|
||||||
color *= m_dimming_factor;
|
color *= m_dimming_factor;
|
||||||
color.setW(1);
|
color.setW(1);
|
||||||
|
|
|
||||||
|
|
@ -544,7 +544,7 @@ template <class NT>
|
||||||
int BiPoly<NT>::getXdegree(){
|
int BiPoly<NT>::getXdegree(){
|
||||||
int deg=-1;
|
int deg=-1;
|
||||||
for(int i=0; i <=ydeg; i++)
|
for(int i=0; i <=ydeg; i++)
|
||||||
deg = max(deg, coeffX[i].getTrueDegree());
|
deg = (max)(deg, coeffX[i].getTrueDegree());
|
||||||
return deg;
|
return deg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1565,7 +1565,7 @@ advanced_make_xy_monotone( const typename CK::Circular_arc_2 &a,
|
||||||
double ymax = (is_on_upper) ?
|
double ymax = (is_on_upper) ?
|
||||||
to_interval
|
to_interval
|
||||||
( CircularFunctors::y_extremal_point<CK>(a.supporting_circle(),false).y() ).second :
|
( CircularFunctors::y_extremal_point<CK>(a.supporting_circle(),false).y() ).second :
|
||||||
CGAL::max(left_bb.ymax(),right_bb.ymax());
|
(CGAL::max)(left_bb.ymax(),right_bb.ymax());
|
||||||
*/
|
*/
|
||||||
return Bbox_2(left_bb.xmin(),ymin,right_bb.xmax(),ymax);
|
return Bbox_2(left_bb.xmin(),ymin,right_bb.xmax(),ymax);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,7 @@ squared_distance(const typename K::Triangle_3& tr1,
|
||||||
FT sqd_q2 = CGAL::squared_distance(vertex(tr2, 1), tr1);
|
FT sqd_q2 = CGAL::squared_distance(vertex(tr2, 1), tr1);
|
||||||
FT sqd_r2 = CGAL::squared_distance(vertex(tr2, 2), tr1);
|
FT sqd_r2 = CGAL::squared_distance(vertex(tr2, 2), tr1);
|
||||||
|
|
||||||
const FT m = std::min({sqd_p1, sqd_q1, sqd_r1, sqd_p2, sqd_q2, sqd_r2});
|
const FT m = (std::min)({sqd_p1, sqd_q1, sqd_r1, sqd_p2, sqd_q2, sqd_r2});
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -2396,8 +2396,12 @@ void MainWindow::viewerShowObject()
|
||||||
}
|
}
|
||||||
if(item) {
|
if(item) {
|
||||||
const Scene::Bbox bbox = item->bbox();
|
const Scene::Bbox bbox = item->bbox();
|
||||||
CGAL::qglviewer::Vec min(static_cast<float>(bbox.xmin())+viewer->offset().x, static_cast<float>(bbox.ymin())+viewer->offset().y, static_cast<float>(bbox.zmin())+viewer->offset().z),
|
CGAL::qglviewer::Vec min{static_cast<float>(bbox.xmin()) + viewer->offset().x,
|
||||||
max(static_cast<float>(bbox.xmax())+viewer->offset().x, static_cast<float>(bbox.ymax())+viewer->offset().y, static_cast<float>(bbox.zmax())+viewer->offset().z);
|
static_cast<float>(bbox.ymin()) + viewer->offset().y,
|
||||||
|
static_cast<float>(bbox.zmin()) + viewer->offset().z};
|
||||||
|
CGAL::qglviewer::Vec max{static_cast<float>(bbox.xmax()) + viewer->offset().x,
|
||||||
|
static_cast<float>(bbox.ymax()) + viewer->offset().y,
|
||||||
|
static_cast<float>(bbox.zmax()) + viewer->offset().z};
|
||||||
viewer->setSceneBoundingBox(min, max);
|
viewer->setSceneBoundingBox(min, max);
|
||||||
viewerShow(static_cast<float>(min.x), static_cast<float>(min.y), static_cast<float>(min.z),
|
viewerShow(static_cast<float>(min.x), static_cast<float>(min.y), static_cast<float>(min.z),
|
||||||
static_cast<float>(max.x), static_cast<float>(max.y), static_cast<float>(max.z));
|
static_cast<float>(max.x), static_cast<float>(max.y), static_cast<float>(max.z));
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,8 @@ void compute(SMesh* sMesh,
|
||||||
for (Vertex_descriptor v : vertices(*sMesh))
|
for (Vertex_descriptor v : vertices(*sMesh))
|
||||||
{
|
{
|
||||||
const PMP::Principal_curvatures_and_directions<Epic_kernel> pc = principal_curvatures_and_directions_map[v];
|
const PMP::Principal_curvatures_and_directions<Epic_kernel> pc = principal_curvatures_and_directions_map[v];
|
||||||
max_curvature_magnitude_on_mesh = std::max(max_curvature_magnitude_on_mesh, std::max(abs(pc.min_curvature), abs(pc.max_curvature)));
|
max_curvature_magnitude_on_mesh =
|
||||||
|
(std::max)(max_curvature_magnitude_on_mesh, (std::max)(abs(pc.min_curvature), abs(pc.max_curvature)));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Vertex_descriptor v : vertices(*sMesh))
|
for(Vertex_descriptor v : vertices(*sMesh))
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ main( int argc, char* argv[])
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// evt. update max_entry:
|
// evt. update max_entry:
|
||||||
max_entry = max( a[dim - 1] + b[dim - 1], max_entry);
|
max_entry = (max)( a[dim - 1] + b[dim - 1], max_entry);
|
||||||
|
|
||||||
// keep both vectors:
|
// keep both vectors:
|
||||||
vectors.push_back( a);
|
vectors.push_back( a);
|
||||||
|
|
|
||||||
|
|
@ -202,8 +202,8 @@ public:
|
||||||
std::pair<double, double> lower_I(CGAL::to_interval(x.lower()));
|
std::pair<double, double> lower_I(CGAL::to_interval(x.lower()));
|
||||||
std::pair<double, double> upper_I(CGAL::to_interval(x.upper()));
|
std::pair<double, double> upper_I(CGAL::to_interval(x.upper()));
|
||||||
return std::pair< double, double >(
|
return std::pair< double, double >(
|
||||||
CGAL::min(lower_I.first , upper_I.first ),
|
(CGAL::min)(lower_I.first , upper_I.first ),
|
||||||
CGAL::max(lower_I.second, upper_I.second));
|
(CGAL::max)(lower_I.second, upper_I.second));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ Random_allocator<T, Upstream_allocator>::allocate(size_type n, const void* hint)
|
||||||
#endif // CGAL_DEBUG_RANDOM_ALLOCATOR
|
#endif // CGAL_DEBUG_RANDOM_ALLOCATOR
|
||||||
return block->data + index;
|
return block->data + index;
|
||||||
}
|
}
|
||||||
size_type block_size = std::max(n * random_size, minimal_block_size);
|
size_type block_size = (std::max)(n * random_size, minimal_block_size);
|
||||||
ptr_->allocate_new_block(block_size);
|
ptr_->allocate_new_block(block_size);
|
||||||
return allocate(n, hint);
|
return allocate(n, hint);
|
||||||
}
|
}
|
||||||
|
|
@ -183,7 +183,7 @@ template <typename T, typename Upstream_allocator>
|
||||||
typename Random_allocator<T, Upstream_allocator>::size_type
|
typename Random_allocator<T, Upstream_allocator>::size_type
|
||||||
Random_allocator<T, Upstream_allocator>::max_size() const noexcept
|
Random_allocator<T, Upstream_allocator>::max_size() const noexcept
|
||||||
{
|
{
|
||||||
return std::numeric_limits<size_type>::max() / sizeof(T);
|
return (std::numeric_limits<size_type>::max)() / sizeof(T);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
|
||||||
|
|
@ -1002,7 +1002,7 @@ namespace nanoflann
|
||||||
if(node->child1 == NULL && node->child2 == NULL)
|
if(node->child1 == NULL && node->child2 == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
else{
|
else{
|
||||||
return std::max(depth(node->child1)+1,depth(node->child2)+1);
|
return (std::max)(depth(node->child1)+1,depth(node->child2)+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1130,8 +1130,8 @@ namespace nanoflann
|
||||||
node->sub.divhigh = right_bbox[cutfeat].low;
|
node->sub.divhigh = right_bbox[cutfeat].low;
|
||||||
|
|
||||||
for (int i=0; i<(DIM>0 ? DIM : dim); ++i) {
|
for (int i=0; i<(DIM>0 ? DIM : dim); ++i) {
|
||||||
bbox[i].low = std::min(left_bbox[i].low, right_bbox[i].low);
|
bbox[i].low = (std::min)(left_bbox[i].low, right_bbox[i].low);
|
||||||
bbox[i].high = std::max(left_bbox[i].high, right_bbox[i].high);
|
bbox[i].high = (std::max)(left_bbox[i].high, right_bbox[i].high);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -118,13 +118,13 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
if (!withE)
|
if (!withE)
|
||||||
{ E=static_cast<unsigned int>(random.get_int
|
{ E=static_cast<unsigned int>(random.get_int
|
||||||
(10, std::max(std::size_t(11),
|
(10, (std::max)(std::size_t(11),
|
||||||
cm.number_of_darts()/10))); }
|
cm.number_of_darts()/10))); }
|
||||||
|
|
||||||
if (!withD)
|
if (!withD)
|
||||||
{ D=static_cast<unsigned int>(random.get_int
|
{ D=static_cast<unsigned int>(random.get_int
|
||||||
(10, std::max(std::size_t(11),
|
(10, (std::max)(std::size_t(11),
|
||||||
cm.number_of_darts()/10))); }
|
cm.number_of_darts()/10))); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ public:
|
||||||
struct Constraint_id
|
struct Constraint_id
|
||||||
{
|
{
|
||||||
Vertex_list_ptr vl = nullptr;
|
Vertex_list_ptr vl = nullptr;
|
||||||
size_type id = std::numeric_limits<size_type>::max();
|
size_type id = (std::numeric_limits<size_type>::max)();
|
||||||
|
|
||||||
Constraint_id(std::nullptr_t = nullptr) {}
|
Constraint_id(std::nullptr_t = nullptr) {}
|
||||||
Constraint_id(Vertex_list_ptr vl, size_type id) : vl(vl), id(id) {}
|
Constraint_id(Vertex_list_ptr vl, size_type id) : vl(vl), id(id) {}
|
||||||
|
|
@ -131,7 +131,7 @@ public:
|
||||||
|
|
||||||
Constraint_id& operator=(std::nullptr_t) {
|
Constraint_id& operator=(std::nullptr_t) {
|
||||||
vl = nullptr;
|
vl = nullptr;
|
||||||
id = std::numeric_limits<size_type>::max();
|
id = (std::numeric_limits<size_type>::max)();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
bool operator==(std::nullptr_t n) const { return vl == n; }
|
bool operator==(std::nullptr_t n) const { return vl == n; }
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue