cleaner tests

This commit is contained in:
Dmitry Anisimov 2021-08-04 13:01:05 +02:00
parent d04c97e4a3
commit 77f686242d
26 changed files with 57 additions and 89 deletions

View File

@ -2,15 +2,19 @@
#define CGAL_SHAPE_REGULARIZATION_TESTS_SAVER_H #define CGAL_SHAPE_REGULARIZATION_TESTS_SAVER_H
// STL includes. // STL includes.
#include <list>
#include <vector> #include <vector>
#include <string> #include <string>
#include <iostream>
#include <fstream> #include <fstream>
#include <iostream>
#include <algorithm>
// CGAL includes. // CGAL includes.
#include <CGAL/IO/io.h> #include <CGAL/utils.h>
#include <CGAL/property_map.h> #include <CGAL/number_utils.h>
#include <CGAL/squared_distance_2.h> #include <CGAL/squared_distance_2.h>
#include <CGAL/property_map.h>
#include <CGAL/IO/io.h>
namespace CGAL { namespace CGAL {
namespace Shape_regularization { namespace Shape_regularization {

View File

@ -18,7 +18,6 @@
#include <CGAL/Kernel/global_functions.h> #include <CGAL/Kernel/global_functions.h>
#include <CGAL/Join_input_iterator.h> #include <CGAL/Join_input_iterator.h>
#include <CGAL/Counting_iterator.h> #include <CGAL/Counting_iterator.h>
#include <CGAL/Random.h>
namespace CGAL { namespace CGAL {
namespace Shape_regularization { namespace Shape_regularization {
@ -144,35 +143,35 @@ void create_example_multiple_directions(
contour.clear(); contour.clear();
contour = { contour = {
Point_2(546115.55975486419629, 5244326.4265436409041), Point_2(546115.559754, 5244326.426543),
Point_2(546117.37262898986228, 5244337.1341805141419), Point_2(546117.372628, 5244337.134180),
Point_2(546116.01587088918313, 5244341.0215584803373), Point_2(546116.015870, 5244341.021558),
Point_2(546117.94300083850976, 5244350.5947591038421), Point_2(546117.943000, 5244350.594759),
Point_2(546112.84907653776463, 5244365.2875102143735), Point_2(546112.849076, 5244365.287510),
Point_2(546107.19443975773174, 5244363.9731347402558), Point_2(546107.194439, 5244363.973134),
Point_2(546106.22850909293629, 5244364.9865339472890), Point_2(546106.228509, 5244364.986533),
Point_2(546110.05300284817349, 5244372.5691289855167), Point_2(546110.053002, 5244372.569128),
Point_2(546105.07976105506532, 5244374.5981351630762), Point_2(546105.079761, 5244374.598135),
Point_2(546093.72503010707442, 5244352.3779847342521), Point_2(546093.725030, 5244352.377984),
Point_2(546091.96853454655502, 5244351.3945095967501), Point_2(546091.968534, 5244351.394509),
Point_2(546091.50930348574184, 5244352.8908741353080), Point_2(546091.509303, 5244352.890874),
Point_2(546103.43633847369347, 5244375.3802235340700), Point_2(546103.436338, 5244375.380223),
Point_2(546102.20120883965865, 5244376.9659267812967), Point_2(546102.201208, 5244376.965926),
Point_2(546091.04900722880848, 5244382.3613784974441), Point_2(546091.049007, 5244382.361378),
Point_2(546081.03281952394173, 5244362.8676363257691), Point_2(546081.032819, 5244362.867636),
Point_2(546078.12493466213346, 5244361.0630018385127), Point_2(546078.124934, 5244361.063001),
Point_2(546078.89294813224114, 5244359.1702114883810), Point_2(546078.892948, 5244359.170211),
Point_2(546073.78569827671163, 5244360.0353698069230), Point_2(546073.785698, 5244360.035369),
Point_2(546066.88938752864487, 5244346.7618661979213), Point_2(546066.889387, 5244346.761866),
Point_2(546088.89068568043876, 5244335.1294597545639), Point_2(546088.890685, 5244335.129459),
Point_2(546094.60000572062563, 5244346.0973066119477), Point_2(546094.600005, 5244346.097306),
Point_2(546096.67206490959506, 5244346.9671173477545), Point_2(546096.672064, 5244346.967117),
Point_2(546103.79629588325042, 5244359.4217483354732), Point_2(546103.796295, 5244359.421748),
Point_2(546107.84054918668699, 5244348.1492590270936), Point_2(546107.840549, 5244348.149259),
Point_2(546106.88664358214010, 5244340.8161107189953), Point_2(546106.886643, 5244340.816110),
Point_2(546100.48662372061517, 5244340.8635002989322), Point_2(546100.486623, 5244340.863500),
Point_2(546098.61382249533199, 5244329.1317009674385), Point_2(546098.613822, 5244329.131700),
Point_2(546106.99944098747801, 5244326.3489141445607) Point_2(546106.999440, 5244326.348914)
}; };
} }

View File

@ -1,4 +1,3 @@
#include "include/utils.h"
#include "include/Saver.h" #include "include/Saver.h"
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>

View File

@ -1,4 +1,3 @@
#include "include/utils.h"
#include "include/Saver.h" #include "include/Saver.h"
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>

View File

@ -1,4 +1,3 @@
#include "include/utils.h"
#include "include/Saver.h" #include "include/Saver.h"
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>

View File

@ -1,4 +1,3 @@
#include "include/utils.h"
#include "include/Saver.h" #include "include/Saver.h"
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
@ -20,22 +19,21 @@ void test_closed_contour_10_edges() {
const Contour contour = { const Contour contour = {
Point_2(0.0, 0.0), Point_2(0.0, 0.0),
Point_2(4.0, 0.0), Point_2(4.0, 0.0),
Point_2(3.815571929821836, 1.503828619292098), Point_2(3.815571, 1.503828),
Point_2(4.518233645117484, 1.605529657032258), Point_2(4.518233, 1.605529),
Point_2(4.0, 2.5), Point_2(4.0, 2.5),
Point_2(4.305586020751696, 2.992361989852617), Point_2(4.305586, 2.992361),
Point_2(4.305586020751696, 3.990881269483276), Point_2(4.305586, 3.990881),
Point_2(2.0, 3.5), Point_2(2.0, 3.5),
Point_2(0.0, 4.0), Point_2(0.0, 4.0),
Point_2(0.182071217832495, 0.505309339661439), Point_2(0.182071, 0.505309),
}; };
assert(contour.size() == 10); assert(contour.size() == 10);
// saver.export_closed_contour(contour, // saver.export_closed_contour(contour,
// "/Users/monet/Documents/gsoc/ggr/logs/cl10_input", 100); // "/Users/monet/Documents/gsoc/ggr/logs/cl10_input", 100);
const bool is_closed = true; const bool is_closed = true;
CD directions( CD directions(contour, is_closed);
contour, is_closed);
std::vector<Point_2> regularized; std::vector<Point_2> regularized;
SR::Contours::regularize_closed_contour( SR::Contours::regularize_closed_contour(

View File

@ -1,4 +1,3 @@
#include "include/utils.h"
#include "include/Saver.h" #include "include/Saver.h"
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
@ -25,8 +24,7 @@ void test_closed_contour_3_edges() {
// "/Users/monet/Documents/gsoc/ggr/logs/cl3_input", 100); // "/Users/monet/Documents/gsoc/ggr/logs/cl3_input", 100);
const bool is_closed = true; const bool is_closed = true;
CD directions( CD directions(contour, is_closed);
contour, is_closed);
std::vector<Point_2> regularized; std::vector<Point_2> regularized;
SR::Contours::regularize_closed_contour( SR::Contours::regularize_closed_contour(

View File

@ -1,4 +1,3 @@
#include "include/utils.h"
#include "include/Saver.h" #include "include/Saver.h"
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
@ -26,8 +25,7 @@ void test_closed_contour_4_edges() {
// "/Users/monet/Documents/gsoc/ggr/logs/cl4_input", 100); // "/Users/monet/Documents/gsoc/ggr/logs/cl4_input", 100);
const bool is_closed = true; const bool is_closed = true;
CD directions( CD directions(contour, is_closed);
contour, is_closed);
std::vector<Point_2> regularized; std::vector<Point_2> regularized;
SR::Contours::regularize_closed_contour( SR::Contours::regularize_closed_contour(

View File

@ -1,4 +1,3 @@
#include "include/utils.h"
#include "include/Saver.h" #include "include/Saver.h"
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
@ -28,8 +27,7 @@ void test_closed_contour_6_edges() {
// "/Users/monet/Documents/gsoc/ggr/logs/cl6_input", 100); // "/Users/monet/Documents/gsoc/ggr/logs/cl6_input", 100);
const bool is_closed = true; const bool is_closed = true;
CD directions( CD directions(contour, is_closed);
contour, is_closed);
std::vector<Point_2> regularized; std::vector<Point_2> regularized;
SR::Contours::regularize_closed_contour( SR::Contours::regularize_closed_contour(

View File

@ -1,4 +1,3 @@
#include "include/utils.h"
#include "include/Saver.h" #include "include/Saver.h"
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>

View File

@ -1,4 +1,3 @@
#include "include/utils.h"
#include "include/Saver.h" #include "include/Saver.h"
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>

View File

@ -1,4 +1,3 @@
#include "include/utils.h"
#include "include/Saver.h" #include "include/Saver.h"
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>

View File

@ -1,4 +1,3 @@
#include "include/utils.h"
#include "include/Saver.h" #include "include/Saver.h"
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>

View File

@ -1,4 +1,3 @@
#include "include/utils.h"
#include "include/Saver.h" #include "include/Saver.h"
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>

View File

@ -1,4 +1,3 @@
#include "include/utils.h"
#include "include/Saver.h" #include "include/Saver.h"
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
@ -34,10 +33,8 @@ void test_equal_contours() {
// "/Users/monet/Documents/gsoc/ggr/logs/op_input", 100); // "/Users/monet/Documents/gsoc/ggr/logs/op_input", 100);
const bool is_closed = true; const bool is_closed = true;
CD closed_directions( CD closed_directions(contour, is_closed, pmap);
contour, is_closed, pmap); OD open_directions(contour, !is_closed, pmap);
OD open_directions(
contour, !is_closed, pmap);
std::vector<Point_2> closed_contour; std::vector<Point_2> closed_contour;
SR::Contours::regularize_closed_contour( SR::Contours::regularize_closed_contour(

View File

@ -1,4 +1,3 @@
#include "include/utils.h"
#include "include/Saver.h" #include "include/Saver.h"
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>

View File

@ -1,4 +1,3 @@
#include "include/utils.h"
#include "include/Saver.h" #include "include/Saver.h"
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>

View File

@ -1,4 +1,3 @@
#include "include/utils.h"
#include "include/Saver.h" #include "include/Saver.h"
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>

View File

@ -1,4 +1,3 @@
#include "include/utils.h"
#include "include/Saver.h" #include "include/Saver.h"
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>

View File

@ -1,4 +1,3 @@
#include "include/utils.h"
#include "include/Saver.h" #include "include/Saver.h"
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
@ -25,8 +24,7 @@ void test_open_contour_1_edge() {
// "/Users/monet/Documents/gsoc/ggr/logs/op1_input", 100); // "/Users/monet/Documents/gsoc/ggr/logs/op1_input", 100);
const bool is_closed = false; const bool is_closed = false;
CD directions( CD directions(contour, is_closed);
contour, is_closed);
std::vector<Point_2> regularized; std::vector<Point_2> regularized;
SR::Contours::regularize_open_contour( SR::Contours::regularize_open_contour(

View File

@ -1,4 +1,3 @@
#include "include/utils.h"
#include "include/Saver.h" #include "include/Saver.h"
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
@ -26,8 +25,7 @@ void test_open_contour_2_edges() {
// "/Users/monet/Documents/gsoc/ggr/logs/op2_input", 100); // "/Users/monet/Documents/gsoc/ggr/logs/op2_input", 100);
const bool is_closed = false; const bool is_closed = false;
CD directions( CD directions(contour, is_closed);
contour, is_closed);
std::vector<Point_2> regularized; std::vector<Point_2> regularized;
SR::Contours::regularize_open_contour( SR::Contours::regularize_open_contour(

View File

@ -1,4 +1,3 @@
#include "include/utils.h"
#include "include/Saver.h" #include "include/Saver.h"
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
@ -26,8 +25,7 @@ void test_open_contour_3_edges() {
// "/Users/monet/Documents/gsoc/ggr/logs/op3_input", 100); // "/Users/monet/Documents/gsoc/ggr/logs/op3_input", 100);
const bool is_closed = false; const bool is_closed = false;
CD directions( CD directions(contour, is_closed);
contour, is_closed);
std::vector<Point_2> regularized; std::vector<Point_2> regularized;
SR::Contours::regularize_open_contour( SR::Contours::regularize_open_contour(

View File

@ -1,4 +1,3 @@
#include "include/utils.h"
#include "include/Saver.h" #include "include/Saver.h"
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
@ -28,8 +27,7 @@ void test_open_contour_5_edges() {
// "/Users/monet/Documents/gsoc/ggr/logs/op5_input", 100); // "/Users/monet/Documents/gsoc/ggr/logs/op5_input", 100);
const bool is_closed = false; const bool is_closed = false;
CD directions( CD directions(contour, is_closed);
contour, is_closed);
std::vector<Point_2> regularized; std::vector<Point_2> regularized;
SR::Contours::regularize_open_contour( SR::Contours::regularize_open_contour(

View File

@ -1,4 +1,3 @@
#include "include/utils.h"
#include "include/Saver.h" #include "include/Saver.h"
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
@ -20,22 +19,21 @@ void test_open_contour_9_edges() {
const Contour contour = { const Contour contour = {
Point_2(0.0, 0.0), Point_2(0.0, 0.0),
Point_2(4.0, 0.0), Point_2(4.0, 0.0),
Point_2(3.815571929821836, 1.503828619292098), Point_2(3.815571, 1.503828),
Point_2(4.518233645117484, 1.605529657032258), Point_2(4.518233, 1.605529),
Point_2(4.0, 2.5), Point_2(4.0, 2.5),
Point_2(4.305586020751696, 2.992361989852617), Point_2(4.305586, 2.992361),
Point_2(4.305586020751696, 3.990881269483276), Point_2(4.305586, 3.990881),
Point_2(2.0, 3.5), Point_2(2.0, 3.5),
Point_2(0.0, 4.0), Point_2(0.0, 4.0),
Point_2(0.182071217832495, 0.505309339661439), Point_2(0.182071, 0.505309),
}; };
assert(contour.size() == 10); assert(contour.size() == 10);
// saver.export_open_contour(contour, // saver.export_open_contour(contour,
// "/Users/monet/Documents/gsoc/ggr/logs/op9_input", 100); // "/Users/monet/Documents/gsoc/ggr/logs/op9_input", 100);
const bool is_closed = false; const bool is_closed = false;
CD directions( CD directions(contour, is_closed);
contour, is_closed);
std::vector<Point_2> regularized; std::vector<Point_2> regularized;
SR::Contours::regularize_open_contour( SR::Contours::regularize_open_contour(

View File

@ -1,4 +1,3 @@
#include "include/utils.h"
#include "include/Saver.h" #include "include/Saver.h"
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>

View File

@ -1,4 +1,3 @@
#include "include/utils.h"
#include "include/Saver.h" #include "include/Saver.h"
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>