Fix the VC++ warnings reported in Issue #1904

This commit is contained in:
Andreas Fabri 2017-02-15 15:38:09 +01:00
parent 5212bb55a6
commit 34e8ed18f0
12 changed files with 30 additions and 24 deletions

View File

@ -617,7 +617,7 @@ find_intersected_hot_pixels(Segment_data & seg,
}
number_of_intersections = hot_pixels_intersected_set.size();
number_of_intersections = static_cast<int>(hot_pixels_intersected_set.size());
}
/*! */

View File

@ -416,7 +416,7 @@ public:
// find the kd trees that have enough candidates (segments with a close
// slope)
int * kd_counter = new int[number_of_trees];
int number_of_segments = seg_list.size();
std::size_t number_of_segments = seg_list.size();
// auxilary directions
Direction_list directions;
@ -529,8 +529,8 @@ public:
// determine right kd-tree to work on, depending on the segment's slope
Direction_2 d = get_direction(s);
int i = 0;
int n = kd_trees_list.size();
std::size_t i = 0;
std::size_t n = kd_trees_list.size();
bool found = false;
typename Kd_triple_list::const_iterator iter = kd_trees_list.begin();

View File

@ -16,6 +16,7 @@
#include <CGAL/boost/graph/iterator.h>
#include <boost/variant.hpp>
#include <boost/lexical_cast.hpp>
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef CGAL::Polyhedron_3<Kernel, CGAL::Polyhedron_items_with_id_3> Polyhedron_3;
@ -95,9 +96,9 @@ int main(int argc, char** argv)
CGAL::set_halfedgeds_items_id(polyhedron);
// pick up a random face
const size_t randSeed = argc > 2 ? std::atoi(argv[2]) : 7915421;
const unsigned int randSeed = argc > 2 ? boost::lexical_cast<unsigned int>(argv[2]) : 7915421;
CGAL::Random rand(randSeed);
const int target_face_index = rand.get_int(0, num_faces(polyhedron));
const int target_face_index = rand.get_int(0, static_cast<int>(num_faces(polyhedron)));
face_iterator face_it = faces(polyhedron).first;
std::advance(face_it,target_face_index);
// ... and define a barycentric coordinates inside the face
@ -109,7 +110,7 @@ int main(int argc, char** argv)
// pick a random target point inside a face
face_it = faces(polyhedron).first;
std::advance(face_it, rand.get_int(0, num_faces(polyhedron)));
std::advance(face_it, rand.get_int(0, static_cast<int>(num_faces(polyhedron))));
// collect the sequence of simplicies crossed by the shortest path
Sequence_collector sequence_collector;

View File

@ -17,6 +17,8 @@
#include <CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path_traits.h>
#include <CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h>
#include <boost/lexical_cast.hpp>
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef OpenMesh::PolyMesh_ArrayKernelT<> Mesh;
@ -37,9 +39,9 @@ int main(int argc, char** argv)
OpenMesh::IO::read_mesh(polyhedron, (argc>1)?argv[1]:"data/elephant.off");
// pick up a random face
const size_t randSeed = argc > 2 ? std::atoi(argv[2]) : 7915421;
const unsigned int randSeed = argc > 2 ? boost::lexical_cast<unsigned int>(argv[2]) : 7915421;
CGAL::Random rand(randSeed);
const int target_face_index = rand.get_int(0, num_faces(polyhedron));
const int target_face_index = rand.get_int(0, static_cast<int>(num_faces(polyhedron)));
face_iterator face_it = faces(polyhedron).first;
std::advance(face_it,target_face_index);
// ... and define a barycentric coordinates inside the face

View File

@ -38,7 +38,7 @@ int main(int argc, char** argv)
CGAL::set_halfedgeds_items_id(polyhedron);
// pick up some source points inside faces,
const size_t randSeed = argc > 2 ? std::atoi(argv[2]) : 7915421;
const unsigned int randSeed = argc > 2 ? boost::lexical_cast<unsigned int>(argv[2]) : 7915421;
CGAL::Random rand(randSeed);
// by copying the faces in a vector to get a direct access to faces
std::size_t nb_faces=num_faces(polyhedron);
@ -51,7 +51,7 @@ int main(int argc, char** argv)
std::vector<Face_location> faceLocations(nb_source_points, Face_location(face_descriptor(), face_location));
for (std::size_t i = 0; i < nb_source_points; ++i)
{
faceLocations[i].first=face_vector[rand.get_int(0, nb_faces)];
faceLocations[i].first=face_vector[rand.get_int(0, static_cast<int>(nb_faces))];
}
// construct a shortest path query object and add a range of source points

View File

@ -16,6 +16,8 @@
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <CGAL/boost/graph/iterator.h>
#include <boost/lexical_cast.hpp>
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron_3;
typedef CGAL::Surface_mesh_shortest_path_traits<Kernel, Polyhedron_3> Traits;
@ -45,9 +47,9 @@ int main(int argc, char** argv)
input.close();
// pick up a random face
const size_t randSeed = argc > 2 ? std::atoi(argv[2]) : 7915421;
const unsigned int randSeed = argc > 2 ? boost::lexical_cast<unsigned int>(argv[2]) : 7915421;
CGAL::Random rand(randSeed);
const int target_face_index = rand.get_int(0, num_faces(polyhedron));
const int target_face_index = rand.get_int(0, static_cast<int>(num_faces(polyhedron)));
face_iterator face_it = faces(polyhedron).first;
std::advance(face_it,target_face_index);
// ... and define a barycentric coordinates inside the face

View File

@ -15,6 +15,7 @@
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <CGAL/boost/graph/iterator.h>
#include <boost/lexical_cast.hpp>
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef CGAL::Polyhedron_3<Kernel, CGAL::Polyhedron_items_with_id_3> Polyhedron_3;
@ -36,9 +37,9 @@ int main(int argc, char** argv)
CGAL::set_halfedgeds_items_id(polyhedron);
// pick up a random face
const size_t randSeed = argc > 2 ? std::atoi(argv[2]) : 7915421;
const unsigned int randSeed = argc > 2 ? boost::lexical_cast<unsigned int>(argv[2]) : 7915421;
CGAL::Random rand(randSeed);
const int target_face_index = rand.get_int(0, num_faces(polyhedron));
const int target_face_index = rand.get_int(0, static_cast<int>(num_faces(polyhedron)));
face_iterator face_it = faces(polyhedron).first;
std::advance(face_it,target_face_index);
// ... and define a barycentric coordinates inside the face

View File

@ -362,7 +362,7 @@ public:
{
}
result_type operator() (const Triangle_3& t3, std::size_t edgeIndex, const Segment_2& segment) const
result_type operator() (const Triangle_3& t3, int edgeIndex, const Segment_2& segment) const
{
Point_3 projectedLocation3d(m_construct_projected_point_3(m_construct_line_3(m_construct_vertex_3(t3, edgeIndex), m_construct_vertex_3(t3, edgeIndex + 1)), m_construct_vertex_3(t3, edgeIndex + 2)));
FT scalePoint = m_parametric_distance_along_segment_3(m_construct_segment_3(m_construct_vertex_3(t3, edgeIndex), m_construct_vertex_3(t3, edgeIndex + 1)), projectedLocation3d);

View File

@ -106,8 +106,8 @@ int main(int argc, char* argv[])
for (size_t i = 0; i < numTests; ++i)
{
size_t startVertexIndex = rand.get_int(0, vertices.size());
size_t endVertexIndex = rand.get_int(0, vertices.size());
size_t startVertexIndex = rand.get_int(0, static_cast<int>(vertices.size()));
size_t endVertexIndex = rand.get_int(0, static_cast<int>(vertices.size()));
vertex_descriptor startVertex = vertices[startVertexIndex];
vertex_descriptor endVertex = vertices[endVertexIndex];
@ -192,8 +192,8 @@ int main(int argc, char* argv[])
for (size_t i = 0; i < numTests; ++i)
{
size_t startFaceIndex = rand.get_int(0, faces.size());
size_t endFaceIndex = rand.get_int(0, faces.size());
size_t startFaceIndex = rand.get_int(0, static_cast<int>(faces.size()));
size_t endFaceIndex = rand.get_int(0, static_cast<int>(faces.size()));
face_descriptor startFace = faces[startFaceIndex];
face_descriptor endFace = faces[endFaceIndex];

View File

@ -87,7 +87,7 @@ int main(int argc, char* argv[])
for (size_t i = 0; i < numTrials; ++i)
{
size_t faceIndex = random.get_int(0, facesList.size());
size_t faceIndex = random.get_int(0, static_cast<int>(facesList.size()));
face_descriptor face = facesList[faceIndex];
Triangle_3 faceTriangle = CGAL::internal::triangle_from_halfedge<Triangle_3, Polyhedron_3, VPM>(halfedge(face, polyhedron), polyhedron, vertexPointMap);

View File

@ -93,7 +93,7 @@ int main(int argc, char* argv[])
for (size_t i = 0; i < numTrials; ++i)
{
size_t faceIndex = random.get_int(0, facesList.size());
size_t faceIndex = random.get_int(0, static_cast<int>(facesList.size()));
face_descriptor face = facesList[faceIndex];
Triangle_3 faceTriangle = CGAL::internal::triangle_from_halfedge<Triangle_3, Polyhedron_3, VPM>(halfedge(face, polyhedron), polyhedron, vertexPointMap);
@ -124,7 +124,7 @@ int main(int argc, char* argv[])
{
Point_3 currentPoint = get(vertexPointMap, *currVertexIt);
for (size_t i = 0; i < 3; ++i)
for (int i = 0; i < 3; ++i)
{
if (first)
{

View File

@ -237,7 +237,7 @@ void nonsimple_flattening_triangle_along_edge()
Traits::Point_3(Kernel::FT(5), Kernel::FT(-9), Kernel::FT(7)),
Traits::Point_3(Kernel::FT(0), Kernel::FT(4), Kernel::FT(5)));
for (size_t edgeIndex = 0; edgeIndex < 3; ++edgeIndex)
for (int edgeIndex = 0; edgeIndex < 3; ++edgeIndex)
{
const Kernel::FT baseDistance = CGAL::sqrt(compute_squared_distance_3(sourceTriangle.vertex(edgeIndex), sourceTriangle.vertex(edgeIndex + 1)));
const Traits::Vector_2 direction(Kernel::FT(3.0) / Kernel::FT(5.0), Kernel::FT(4.0) / Kernel::FT(5.0));