time to unsigned int conversion warnings fix

This commit is contained in:
Dmitry Anisimov 2019-05-20 10:05:48 +02:00
parent 76feac2716
commit b2d64c796c
5 changed files with 14 additions and 10 deletions

View File

@ -187,7 +187,7 @@ private:
using Vertex_to_point_map = typename Region_type::Vertex_to_point_map; using Vertex_to_point_map = typename Region_type::Vertex_to_point_map;
using Region_growing = CGAL::Shape_detection::Region_growing<Face_range, Neighbor_query, Region_type>; using Region_growing = CGAL::Shape_detection::Region_growing<Face_range, Neighbor_query, Region_type>;
CGAL::Random rand(time(0)); CGAL::Random rand(static_cast<unsigned int>(time(0)));
const SMesh& mesh = *(sm_item->polyhedron()); const SMesh& mesh = *(sm_item->polyhedron());
scene->setSelectedItem(-1); scene->setSelectedItem(-1);
const Face_range face_range = faces(mesh); const Face_range face_range = faces(mesh);
@ -273,7 +273,7 @@ private:
dialog.min_points(); dialog.min_points();
// Get a point set. // Get a point set.
CGAL::Random rand(time(0)); CGAL::Random rand(static_cast<unsigned int>(time(0)));
Point_set* points = item->point_set(); Point_set* points = item->point_set();
scene->setSelectedItem(-1); scene->setSelectedItem(-1);
@ -538,7 +538,7 @@ private:
op.cluster_epsilon = dialog.cluster_epsilon(); // maximum euclidean distance between points to be clustered. op.cluster_epsilon = dialog.cluster_epsilon(); // maximum euclidean distance between points to be clustered.
op.normal_threshold = dialog.normal_tolerance(); // normal_threshold < dot(surface_normal, point_normal); op.normal_threshold = dialog.normal_tolerance(); // normal_threshold < dot(surface_normal, point_normal);
CGAL::Random rand(time(0)); CGAL::Random rand(static_cast<unsigned int>(time(0)));
// Gets point set // Gets point set
Point_set* points = item->point_set(); Point_set* points = item->point_set();
@ -1049,7 +1049,7 @@ void Polyhedron_demo_point_set_shape_detection_plugin::build_alpha_shape
void Polyhedron_demo_point_set_shape_detection_plugin::on_actionEstimateParameters_triggered() { void Polyhedron_demo_point_set_shape_detection_plugin::on_actionEstimateParameters_triggered() {
CGAL::Random rand(time(0)); CGAL::Random rand(static_cast<unsigned int>(time(0)));
const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex(); const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
Scene_points_with_normal_item* item = Scene_points_with_normal_item* item =

View File

@ -123,7 +123,7 @@ int main(int argc, char *argv[]) {
<< std::endl; << std::endl;
Pwc_vector pwc; Pwc_vector pwc;
srand(time(NULL)); srand(static_cast<unsigned int>(time(NULL)));
// Iterate through all regions. // Iterate through all regions.
for (const auto& region : regions) { for (const auto& region : regions) {

View File

@ -121,7 +121,7 @@ int main(int argc, char *argv[]) {
using Face_index = typename Polygon_mesh::Face_index; using Face_index = typename Polygon_mesh::Face_index;
// Save the result to a file in the user-provided path if any. // Save the result to a file in the user-provided path if any.
srand(time(NULL)); srand(static_cast<unsigned int>(time(NULL)));
if (argc > 2) { if (argc > 2) {
bool created; bool created;

View File

@ -530,7 +530,8 @@ namespace CGAL {
bool done = false; bool done = false;
do { do {
do do
first_sample = get_default_random()(m_num_available_points); first_sample = get_default_random()(
static_cast<unsigned int>(m_num_available_points));
while (m_shape_index[first_sample] != -1); while (m_shape_index[first_sample] != -1);
done = m_global_octree->drawSamplesFromCellContainingPoint( done = m_global_octree->drawSamplesFromCellContainingPoint(
@ -876,7 +877,8 @@ namespace CGAL {
private: private:
int select_random_octree_level() { int select_random_octree_level() {
return (int) get_default_random()(m_global_octree->maxLevel() + 1); return (int) get_default_random()(
static_cast<unsigned int>(m_global_octree->maxLevel() + 1));
} }
Shape* get_best_candidate(std::vector<Shape* >& candidates, Shape* get_best_candidate(std::vector<Shape* >& candidates,

View File

@ -501,7 +501,8 @@ namespace CGAL {
int score = 0; int score = 0;
std::vector<std::size_t> indices(num); std::vector<std::size_t> indices(num);
for (std::size_t i = 0;i<num;i++) for (std::size_t i = 0;i<num;i++)
indices[i] = m_indices[get_default_random()(m_indices.size())]; indices[i] = m_indices[get_default_random()(
static_cast<unsigned int>(m_indices.size()))];
std::vector<FT> dists(num), angles(num); std::vector<FT> dists(num), angles(num);
other->squared_distance(indices, dists); other->squared_distance(indices, dists);
@ -515,7 +516,8 @@ namespace CGAL {
return false; return false;
for (std::size_t i = 0;i<num;i++) for (std::size_t i = 0;i<num;i++)
indices[i] = other->m_indices[get_default_random()(other->m_indices.size())]; indices[i] = other->m_indices[get_default_random()(
static_cast<unsigned int>(other->m_indices.size()))];
this->squared_distance(indices, dists); this->squared_distance(indices, dists);
this->cos_to_normal(indices, angles); this->cos_to_normal(indices, angles);