From f08b0bd1fb501e224e77a631f0c4c7f9f5e528d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dlker=20Yaz?= Date: Wed, 22 Aug 2012 15:54:56 +0000 Subject: [PATCH] Update examples (tabs vs spaces) --- .../sdf_values_computation_example.cpp | 12 +++---- .../surface_mesh_segmentation_example.cpp | 11 ++++--- ...h_segmentation_from_sdf_values_example.cpp | 4 +-- ...sh_segmentation_with_facet_ids_example.cpp | 31 ++++++++++--------- 4 files changed, 31 insertions(+), 27 deletions(-) diff --git a/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/sdf_values_computation_example.cpp b/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/sdf_values_computation_example.cpp index 4e629a152ba..ec8ff43809b 100644 --- a/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/sdf_values_computation_example.cpp +++ b/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/sdf_values_computation_example.cpp @@ -14,8 +14,8 @@ typedef CGAL::Polyhedron_3 Polyhedron; int main(int argc, char **argv) { if (argc !=2){ - std::cerr << "Usage: " << argv[0] << " input.off\n"; - return 1; + std::cerr << "Usage: " << argv[0] << " input.off\n"; + return 1; } // create and read Polyhedron @@ -23,8 +23,8 @@ int main(int argc, char **argv) std::ifstream input(argv[1]); if ( !input || !(input >> mesh) || mesh.empty() ){ - std::cerr << argv[1] << " is not a valid off file.\n"; - return 1; + std::cerr << argv[1] << " is not a valid off file.\n"; + return 1; } // create a property-map (it is an adaptor for this case) @@ -34,8 +34,8 @@ int main(int argc, char **argv) // compute sdf values using default parameters for number of rays, and cone angle std::pair min_max_sdf = CGAL::sdf_values_computation(mesh, sdf_property_map); - // print minimum & maximum sdf values - std::cout << "minimum sdf: " << pair.first << " maximum sdf: " << pair.second << std::endl; + // print minimum & maximum sdf values + std::cout << "minimum sdf: " << pair.first << " maximum sdf: " << pair.second << std::endl; // print sdf values for(Polyhedron::Facet_const_iterator facet_it = mesh.facets_begin(); facet_it != mesh.facets_end(); ++facet_it) diff --git a/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/surface_mesh_segmentation_example.cpp b/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/surface_mesh_segmentation_example.cpp index e736f0f22e9..dc5c6165fef 100644 --- a/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/surface_mesh_segmentation_example.cpp +++ b/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/surface_mesh_segmentation_example.cpp @@ -14,8 +14,8 @@ typedef CGAL::Polyhedron_3 Polyhedron; int main(int argc, char **argv) { if (argc !=2){ - std::cerr << "Usage: " << argv[0] << " input.off\n"; - return 1; + std::cerr << "Usage: " << argv[0] << " input.off\n"; + return 1; } // create and read Polyhedron @@ -23,8 +23,8 @@ int main(int argc, char **argv) std::ifstream input(argv[1]); if ( !input || !(input >> mesh) || mesh.empty() ){ - std::cerr << argv[1] << " is not a valid off file.\n"; - return 1; + std::cerr << argv[1] << " is not a valid off file.\n"; + return 1; } // create a property-map for segment-ids (it is an adaptor for this case) @@ -33,8 +33,9 @@ int main(int argc, char **argv) boost::associative_property_map segment_property_map(internal_segment_map); // calculate SDF values and segment the mesh using default parameters. - CGAL::surface_mesh_segmentation(mesh, segment_property_map); + int number_of_segments = CGAL::surface_mesh_segmentation(mesh, segment_property_map); + std::cout << "Number of segments: " << number_of_segments << std::endl; // print segment-ids for(Polyhedron::Facet_const_iterator facet_it = mesh.facets_begin(); facet_it != mesh.facets_end(); ++facet_it) diff --git a/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/surface_mesh_segmentation_from_sdf_values_example.cpp b/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/surface_mesh_segmentation_from_sdf_values_example.cpp index 87825161aee..76951c19f81 100644 --- a/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/surface_mesh_segmentation_from_sdf_values_example.cpp +++ b/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/surface_mesh_segmentation_from_sdf_values_example.cpp @@ -44,12 +44,12 @@ int main(int argc, char **argv) // segment the mesh using default parameters for number of levels, and smoothing lambda int number_of_segments = CGAL::surface_mesh_segmentation_from_sdf_values(mesh, sdf_property_map, segment_property_map); - std::cout << "Number of segments: " << number_of_segments << std::endl; + std::cout << "Number of segments: " << number_of_segments << std::endl; // print segment-ids for(Polyhedron::Facet_const_iterator facet_it = mesh.facets_begin(); facet_it != mesh.facets_end(); ++facet_it) { - // ids are between [0, number_of_segments -1] + // ids are between [0, number_of_segments -1] std::cout << segment_property_map[facet_it] << std::endl; } diff --git a/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/surface_mesh_segmentation_with_facet_ids_example.cpp b/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/surface_mesh_segmentation_with_facet_ids_example.cpp index bcadce36e98..b45435de636 100644 --- a/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/surface_mesh_segmentation_with_facet_ids_example.cpp +++ b/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/surface_mesh_segmentation_with_facet_ids_example.cpp @@ -50,33 +50,36 @@ int main(int argc, char **argv) std::cerr << argv[1] << " is not a valid off file.\n"; return 1; } - // assign id field for each facet - int facet_id = 0; - for(Polyhedron::Facet_iterator facet_it = mesh.facets_begin(); facet_it != mesh.facets_end(); - ++facet_it, ++facet_id) + + // assign id field for each facet + int facet_id = 0; + for(Polyhedron::Facet_iterator facet_it = mesh.facets_begin(); + facet_it != mesh.facets_end(); ++facet_it, ++facet_id) { facet_it->id() = facet_id; } + // create a property-map for sdf values - std::vector sdf_values(mesh.size_of_facets()); - Polyhedron_with_id_to_vector_property_map sdf_property_map(&sdf_values); + std::vector sdf_values(mesh.size_of_facets()); + Polyhedron_with_id_to_vector_property_map sdf_property_map(&sdf_values); CGAL::sdf_values_computation(mesh, sdf_property_map); - // access sdf values (with constant-complexity) either via sdf_values or sdf_property_map - for(Polyhedron::Facet_const_iterator facet_it = mesh.facets_begin(); - facet_it != mesh.facets_end(); ++facet_it) + // access sdf values (with constant-complexity) either via sdf_values or sdf_property_map + for(Polyhedron::Facet_const_iterator facet_it = mesh.facets_begin(); + facet_it != mesh.facets_end(); ++facet_it) { - std::cout << (sdf_property_map[facet_it] == sdf_values[facet_it->id()]) << std::endl; - } + std::cout << (sdf_property_map[facet_it] == sdf_values[facet_it->id()]) << std::endl; + } + // create a property-map for segment-ids - std::vector segment_ids(mesh.size_of_facets()); - Polyhedron_with_id_to_vector_property_map segment_property_map(&segment_ids); + std::vector segment_ids(mesh.size_of_facets()); + Polyhedron_with_id_to_vector_property_map segment_property_map(&segment_ids); CGAL::surface_mesh_segmentation_from_sdf_values(mesh, sdf_property_map, segment_property_map); // access segment-ids (with constant-complexity) either via segment_ids or segment_property_map for(Polyhedron::Facet_const_iterator facet_it = mesh.facets_begin(); - facet_it != mesh.facets_end(); ++facet_it) + facet_it != mesh.facets_end(); ++facet_it) { std::cout << (segment_property_map[facet_it] == segment_ids[facet_it->id()]) << std::endl; }