Update examples and tests

This commit is contained in:
Simon Giraudot 2016-09-26 15:35:24 +02:00
parent febe156cea
commit 5a0e3ef36e
5 changed files with 33 additions and 11 deletions

View File

@ -16,7 +16,8 @@ void print_point_set (const Point_set& point_set)
std::cerr << "Content of point set:" << std::endl; std::cerr << "Content of point set:" << std::endl;
for (Point_set::const_iterator it = point_set.begin(); for (Point_set::const_iterator it = point_set.begin();
it != point_set.end(); ++ it) it != point_set.end(); ++ it)
std::cerr << "* Point " << point_set.point(*it) // or point_set[it] std::cerr << "* Point " << *it
<< ": " << point_set.point(*it) // or point_set[it]
<< " with normal " << point_set.normal(*it) << " with normal " << point_set.normal(*it)
<< std::endl; << std::endl;
} }
@ -37,9 +38,10 @@ int main (int, char**)
print_point_set(point_set); // Normals have default values print_point_set(point_set); // Normals have default values
// Change normal values // Change normal values
point_set.normal(0) = Vector (1., 0., 0.); Point_set::iterator it = point_set.begin();
point_set.normal(1) = Vector (0., 1., 0.); point_set.normal(*(it++)) = Vector (1., 0., 0.);
point_set.normal(2) = Vector (0., 0., 1.); point_set.normal(*(it++)) = Vector (0., 1., 0.);
point_set.normal(*(it++)) = Vector (0., 0., 1.);
// Add point + normal // Add point + normal
point_set.insert (Point (1., 2., 3.), Vector (4., 5., 6.)); point_set.insert (Point (1., 2., 3.), Vector (4., 5., 6.));
@ -52,7 +54,8 @@ int main (int, char**)
print_point_set(point_set); // New item has default values print_point_set(point_set); // New item has default values
point_set.remove (point_set.begin()); point_set.remove (point_set.begin() + 2,
point_set.begin() + 4);
print_point_set(point_set); // New item has default values print_point_set(point_set); // New item has default values

View File

@ -1,6 +1,7 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Point_set_3.h> #include <CGAL/Point_set_3.h>
#include <CGAL/Point_set_3/Point_set_processing_3.h> #include <CGAL/Point_set_3/Point_set_processing_3.h>
#include <CGAL/Point_set_3/IO.h>
#include <CGAL/grid_simplify_point_set.h> #include <CGAL/grid_simplify_point_set.h>
#include <CGAL/Shape_detection_3.h> #include <CGAL/Shape_detection_3.h>

View File

@ -1,6 +1,6 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Point_set_3.h> #include <CGAL/Point_set_3.h>
#include <CGAL/Point_set_3/Point_set_processing_3.h> #include <CGAL/Point_set_3/IO.h>
#include <fstream> #include <fstream>
#include <limits> #include <limits>

View File

@ -1,8 +1,6 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Point_set_3.h> #include <CGAL/Point_set_3.h>
#include <CGAL/IO/read_xyz_points.h> #include <CGAL/Point_set_3/IO.h>
#include <CGAL/IO/write_off_points.h>
#include <CGAL/Point_set_3/Point_set_processing_3.h>
#include <fstream> #include <fstream>
#include <limits> #include <limits>

View File

@ -51,6 +51,24 @@ int main (int, char**)
point_set.remove_from (first_to_remove); point_set.remove_from (first_to_remove);
test ((point_set.size() + point_set.garbage_size() == size), "sizes before and after removal do not match."); test ((point_set.size() + point_set.garbage_size() == size), "sizes before and after removal do not match.");
Point_set::Point_range
range = point_set.points();
{
Point_set::const_iterator psit = point_set.begin();
bool range_okay = true;
for (Point_set::Point_range::const_iterator it = range.begin(); it != range.end(); ++ it)
{
if (*it != point_set.point (*psit))
{
range_okay = false;
break;
}
++ psit;
}
test (range_okay, "range access does not follow property map based access.");
}
test (point_set.has_garbage(), "point set should have garbage."); test (point_set.has_garbage(), "point set should have garbage.");
point_set.collect_garbage(); point_set.collect_garbage();
test (!(point_set.has_garbage()), "point set shouldn't have garbage."); test (!(point_set.has_garbage()), "point set shouldn't have garbage.");
@ -81,6 +99,8 @@ int main (int, char**)
point_set.remove_property_map<Color> (color_prop); point_set.remove_property_map<Color> (color_prop);
test (!(point_set.has_property_map<Color> ("color")), "point set shouldn't have colors."); test (!(point_set.has_property_map<Color> ("color")), "point set shouldn't have colors.");
std::cerr << nb_success << "/" << nb_test << " test(s) succeeded." << std::endl; std::cerr << nb_success << "/" << nb_test << " test(s) succeeded." << std::endl;
return EXIT_SUCCESS; return EXIT_SUCCESS;