mirror of https://github.com/CGAL/cgal
addition of Kinetic_shape_partitioning_Traits_3
separation of Kinetic_shape_reconstruction_3 into Kinetic_shape_partitioning_3 and Kinetic_shape_reconstruction_3 (WIP) adding Linear_cell_complex to dependencies renaming a few parameters in KSR::Parameters_3 removal and renaming of named parameters one pass on the documentation
This commit is contained in:
parent
41811ce424
commit
f741e3516d
|
|
@ -1,3 +1,5 @@
|
|||
Manual
|
||||
Kernel_23
|
||||
BGL
|
||||
Linear_cell_complex
|
||||
Surface_mesh
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Kinetic_shape_reconstruction_3.h>
|
||||
#include <CGAL/Kinetic_shape_partitioning_3.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
#include <CGAL/Real_timer.h>
|
||||
#include <CGAL/IO/OFF.h>
|
||||
|
|
@ -12,6 +12,8 @@ using SCD = CGAL::Simple_cartesian<double>;
|
|||
using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||
using EPECK = CGAL::Exact_predicates_exact_constructions_kernel;
|
||||
|
||||
using Traits = typename CGAL::Kinetic_shape_partitioning_Traits_3<EPICK, EPECK, std::vector<typename EPICK::Point_3>, CGAL::Identity_property_map<typename EPICK::Point_3> >;
|
||||
|
||||
using Kernel = EPICK;
|
||||
using FT = typename Kernel::FT;
|
||||
using Point_2 = typename Kernel::Point_2;
|
||||
|
|
@ -20,7 +22,7 @@ using Segment_3 = typename Kernel::Segment_3;
|
|||
using Triangle_2 = typename Kernel::Triangle_2;
|
||||
|
||||
using Surface_mesh = CGAL::Surface_mesh<Point_3>;
|
||||
using KSR = CGAL::Kinetic_shape_reconstruction_3<Kernel>;
|
||||
using KSR = CGAL::Kinetic_shape_partitioning_3<Traits>;
|
||||
using Timer = CGAL::Real_timer;
|
||||
|
||||
struct Polygon_map {
|
||||
|
|
@ -81,10 +83,8 @@ int main(const int argc, const char** argv) {
|
|||
const bool verbose = true;
|
||||
const bool debug = false;
|
||||
const unsigned int k = (argc > 2 ? std::atoi(argv[2]) : 1); // intersections
|
||||
const unsigned int subdiv = 0;
|
||||
const double eratio = 1.1;
|
||||
const bool orient = false;
|
||||
const bool use_hm = false;
|
||||
|
||||
// Algorithm.
|
||||
KSR ksr(verbose, debug);
|
||||
|
|
@ -92,24 +92,24 @@ int main(const int argc, const char** argv) {
|
|||
|
||||
Timer timer;
|
||||
timer.start();
|
||||
const bool is_ksr_success = ksr.partition(
|
||||
bool is_ksr_success = ksr.initialize(
|
||||
input_faces, polygon_map, CGAL::parameters::
|
||||
k_intersections(k).
|
||||
n_subdivisions(subdiv).
|
||||
enlarge_bbox_ratio(eratio).
|
||||
reorient(orient).
|
||||
use_hybrid_mode(use_hm));
|
||||
bbox_dilation_ratio(eratio).
|
||||
reorient_bbox(orient));
|
||||
|
||||
if (is_ksr_success)
|
||||
is_ksr_success = ksr.partition(k);
|
||||
|
||||
assert(is_ksr_success);
|
||||
const std::string success = is_ksr_success ? "SUCCESS" : "FAILED";
|
||||
timer.stop();
|
||||
const FT time = static_cast<FT>(timer.time());
|
||||
const std::size_t num_events = ksr.number_of_events();
|
||||
|
||||
// Output.
|
||||
const int support_plane_idx = -1;
|
||||
const int num_support_planes = ksr.number_of_support_planes();
|
||||
assert(num_support_planes > 6);
|
||||
assert(ksr.support_plane_index(0) == 6);
|
||||
assert(ksr.support_plane_index(0) == 6);/*
|
||||
|
||||
// Vertices.
|
||||
const std::size_t num_vertices = ksr.number_of_vertices(support_plane_idx);
|
||||
|
|
@ -218,7 +218,7 @@ int main(const int argc, const char** argv) {
|
|||
// CGAL::IO::write_PLY(output_file_support_plane, support_planes[i]);
|
||||
// output_file_support_plane.close();
|
||||
// }
|
||||
// std::cout << "* partition support planes exported successfully" << std::endl;
|
||||
// std::cout << "* partition support planes exported successfully" << std::endl;*/
|
||||
|
||||
std::cout << std::endl << "3D KINETIC " << success <<
|
||||
" in " << time << " seconds!" << std::endl << std::endl;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include <CGAL/random_convex_set_2.h>
|
||||
#include <CGAL/Polygon_with_holes_2.h>
|
||||
#include <CGAL/Boolean_set_operations_2.h>
|
||||
#include <CGAL/Kinetic_shape_reconstruction_3.h>
|
||||
#include <CGAL/Kinetic_shape_partitioning_3.h>
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Polygon_2_algorithms.h>
|
||||
|
|
@ -36,7 +36,9 @@ using IPoint_3 = typename EPICK::Point_3;
|
|||
using IPolygon_3 = std::vector<IPoint_3>;
|
||||
using IPolygon_3_map = CGAL::Identity_property_map<IPolygon_3>;
|
||||
|
||||
using KSR = CGAL::Kinetic_shape_reconstruction_3<EPICK>;
|
||||
using Traits = typename CGAL::Kinetic_shape_partitioning_Traits_3<EPICK, EPECK, std::vector<typename EPICK::Point_3>, CGAL::Identity_property_map<typename EPICK::Point_3> >;
|
||||
|
||||
using KSP = CGAL::Kinetic_shape_partitioning_3<Traits>;
|
||||
|
||||
const std::vector<int> box_vertices_to_faces(const int i) {
|
||||
const int _vertices_to_faces[8][3] = {
|
||||
|
|
@ -403,14 +405,19 @@ int main(const int argc, const char** argv) {
|
|||
assert(input_polygons.size() == rnd_polygons.size());
|
||||
|
||||
// Algorithm.
|
||||
KSR ksr(true, false);
|
||||
KSP ksp(true, false);
|
||||
const IPolygon_3_map polygon_map;
|
||||
const unsigned int k = (argc > 3 ? std::atoi(argv[3]) : 1);
|
||||
std::cout << "* input k: " << k << std::endl;
|
||||
const bool is_ksr_success = ksr.partition(
|
||||
input_polygons, polygon_map, CGAL::parameters::k_intersections(k));
|
||||
assert(is_ksr_success);
|
||||
const std::string success = is_ksr_success ? "SUCCESS" : "FAILED";
|
||||
|
||||
bool is_ksp_success = ksp.initialize(
|
||||
input_polygons, polygon_map);
|
||||
|
||||
if (is_ksp_success)
|
||||
ksp.partition(k);
|
||||
|
||||
assert(is_ksp_success);
|
||||
const std::string success = is_ksp_success ? "SUCCESS" : "FAILED";
|
||||
|
||||
std::cout << std::endl << "3D KINETIC " << success << "!" << std::endl << std::endl;
|
||||
return EXIT_SUCCESS;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include "include/Terminal_parser.h"
|
||||
|
||||
using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||
using EPECK = CGAL::Exact_predicates_exact_constructions_kernel;
|
||||
using FT = typename Kernel::FT;
|
||||
using Point_3 = typename Kernel::Point_3;
|
||||
using Vector_3 = typename Kernel::Vector_3;
|
||||
|
|
@ -17,12 +18,14 @@ using Segment_3 = typename Kernel::Segment_3;
|
|||
|
||||
using Point_set = CGAL::Point_set_3<Point_3>;
|
||||
using Point_map = typename Point_set::Point_map;
|
||||
using Vector_map = typename Point_set::Vector_map;
|
||||
using Normal_map = typename Point_set::Vector_map;
|
||||
using Label_map = typename Point_set:: template Property_map<int>;
|
||||
using Semantic_map = CGAL::KSR::Semantic_from_label_map<Label_map>;
|
||||
using Region_map = typename Point_set:: template Property_map<int>;
|
||||
|
||||
using KSR = CGAL::Kinetic_shape_reconstruction_3<Kernel, CGAL::Exact_predicates_exact_constructions_kernel>;
|
||||
using Traits = typename CGAL::Kinetic_shape_partitioning_Traits_3<Kernel, EPECK, Point_set, Point_map>;
|
||||
|
||||
using KSR = CGAL::Kinetic_shape_reconstruction_3<Traits, Normal_map>;
|
||||
|
||||
using Parameters = CGAL::KSR::All_parameters<FT>;
|
||||
using Terminal_parser = CGAL::KSR::Terminal_parser<FT>;
|
||||
|
|
@ -111,7 +114,6 @@ int main(const int argc, const char** argv) {
|
|||
}
|
||||
else {
|
||||
std::ifstream input_file(parameters.data, std::ios_base::binary);
|
||||
bool f = input_file.is_open();
|
||||
input_file >> point_set;
|
||||
input_file.close();
|
||||
}
|
||||
|
|
@ -129,18 +131,6 @@ int main(const int argc, const char** argv) {
|
|||
std::cout << "verbose " << parameters.verbose << std::endl;
|
||||
std::cout << "debug " << parameters.debug << std::endl;
|
||||
|
||||
// Define a map from a user-defined label to the semantic label.
|
||||
const Label_map label_map = point_set. template property_map<int>("label").first;
|
||||
const bool is_defined = point_set. template property_map<int>("label").second;
|
||||
const Semantic_map semantic_map(
|
||||
label_map,
|
||||
is_defined,
|
||||
parameters.gi,
|
||||
parameters.bi,
|
||||
parameters.ii,
|
||||
parameters.vi,
|
||||
parameters.verbose);
|
||||
|
||||
// Algorithm.
|
||||
KSR ksr(parameters.verbose, parameters.debug);
|
||||
|
||||
|
|
@ -149,13 +139,38 @@ int main(const int argc, const char** argv) {
|
|||
|
||||
Timer timer;
|
||||
timer.start();
|
||||
bool is_ksr_success;
|
||||
std::size_t num_shapes = ksr.detect_planar_shapes(point_set,
|
||||
CGAL::parameters::distance_threshold(parameters.distance_threshold)
|
||||
.angle_threshold(parameters.angle_threshold)
|
||||
.k_neighbors(parameters.k_neighbors)
|
||||
.min_region_size(parameters.min_region_size));
|
||||
|
||||
std::cout << num_shapes << " detected planar shapes" << std::endl;
|
||||
|
||||
num_shapes = ksr.regularize_shapes(CGAL::parameters::regularize_parallelism(true).regularize_coplanarity(true).regularize_axis_symmetry(false).regularize_orthogonality(false));
|
||||
|
||||
std::cout << num_shapes << " detected planar shapes after regularization" << std::endl;
|
||||
|
||||
bool is_ksr_success = ksr.initialize_partitioning();
|
||||
|
||||
if (!is_ksr_success) {
|
||||
std::cout << "Initializing kinetic partitioning failed!" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
is_ksr_success = ksr.partition(parameters.k_intersections);
|
||||
|
||||
if (!is_ksr_success) {
|
||||
std::cout << "Initializing kinetic partitioning failed!" << std::endl;
|
||||
return 2;
|
||||
}
|
||||
|
||||
ksr.setup_energyterms();
|
||||
|
||||
ksr.reconstruct(parameters.graphcut_beta);
|
||||
/*
|
||||
if (is_segmented)
|
||||
is_ksr_success = ksr.reconstruct(
|
||||
point_set,
|
||||
point_set.point_map(),
|
||||
point_set.normal_map(),
|
||||
semantic_map,
|
||||
region_map,
|
||||
CGAL::parameters::
|
||||
k_neighbors(parameters.k_neighbors).
|
||||
|
|
@ -167,10 +182,6 @@ int main(const int argc, const char** argv) {
|
|||
graphcut_beta(parameters.graphcut_beta));
|
||||
else
|
||||
is_ksr_success = ksr.reconstruct(
|
||||
point_set,
|
||||
point_set.point_map(),
|
||||
point_set.normal_map(),
|
||||
semantic_map,
|
||||
base,
|
||||
CGAL::parameters::
|
||||
k_neighbors(parameters.k_neighbors).
|
||||
|
|
@ -179,35 +190,38 @@ int main(const int argc, const char** argv) {
|
|||
min_region_size(parameters.min_region_size).
|
||||
regularize(parameters.regularize).
|
||||
k_intersections(parameters.k_intersections).
|
||||
graphcut_beta(parameters.graphcut_beta));
|
||||
graphcut_beta(parameters.graphcut_beta));*/
|
||||
assert(is_ksr_success);
|
||||
const std::string success = is_ksr_success ? "SUCCESS" : "FAILED";
|
||||
timer.stop();
|
||||
const FT time = static_cast<FT>(timer.time());
|
||||
|
||||
const KSR::KSP& ksp = ksr.partitioning();
|
||||
|
||||
// Output.
|
||||
CGAL::Linear_cell_complex_for_combinatorial_map<3, 3> lcc;
|
||||
ksr.get_linear_cell_complex(lcc);
|
||||
ksp.get_linear_cell_complex(lcc);
|
||||
/*
|
||||
|
||||
// Vertices.
|
||||
std::vector<Point_3> all_vertices;
|
||||
ksr.output_partition_vertices(
|
||||
ksp.output_partition_vertices(
|
||||
std::back_inserter(all_vertices), -1);
|
||||
|
||||
// Edges.
|
||||
std::vector<Segment_3> all_edges;
|
||||
ksr.output_partition_edges(
|
||||
ksp.output_partition_edges(
|
||||
std::back_inserter(all_edges), -1);
|
||||
|
||||
// Faces.
|
||||
std::vector< std::vector<std::size_t> > all_faces;
|
||||
ksr.output_partition_faces(
|
||||
ksp.output_partition_faces(
|
||||
std::back_inserter(all_faces), -1, 6);
|
||||
|
||||
// Model.
|
||||
std::vector<Point_3> output_vertices;
|
||||
std::vector< std::vector<std::size_t> > output_faces;
|
||||
ksr.output_reconstructed_model(
|
||||
ksp.output_reconstructed_model(
|
||||
std::back_inserter(output_vertices),
|
||||
std::back_inserter(output_faces));
|
||||
const std::size_t num_vertices = output_vertices.size();
|
||||
|
|
@ -251,7 +265,7 @@ int main(const int argc, const char** argv) {
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
output_file_model.close();
|
||||
std::cout << "* the reconstructed model exported successfully" << std::endl;
|
||||
std::cout << "* the reconstructed model exported successfully" << std::endl;*/
|
||||
|
||||
std::cout << std::endl << "3D KINETIC RECONSTRUCTION " << success <<
|
||||
" in " << time << " seconds!" << std::endl << std::endl;
|
||||
|
|
|
|||
|
|
@ -1,97 +0,0 @@
|
|||
// Copyright (c) 2021 GeometryFactory SARL (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||
//
|
||||
//
|
||||
// Author(s) : Simon Giraudot, Dmitry Anisimov
|
||||
|
||||
#ifndef CGAL_KSR_CONVERSIONS_H
|
||||
#define CGAL_KSR_CONVERSIONS_H
|
||||
|
||||
// #include <CGAL/license/Kinetic_shape_reconstruction.h>
|
||||
|
||||
// STL includes.
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
// CGAL includes.
|
||||
#include <CGAL/assertions.h>
|
||||
#include <CGAL/intersections.h>
|
||||
#include <CGAL/Cartesian_converter.h>
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
|
||||
namespace CGAL {
|
||||
namespace KSR {
|
||||
|
||||
template<typename GeomTraits>
|
||||
class Kinetic_traits_3 {
|
||||
|
||||
using IK = GeomTraits; // assume GT is inexact here
|
||||
|
||||
using IT = typename GeomTraits::FT;
|
||||
using Point_2 = typename GeomTraits::Point_2;
|
||||
using Line_2 = typename GeomTraits::Line_2;
|
||||
|
||||
// TODO: This is very naive way of doing this. We should compare IT and ET
|
||||
// and, in case they are the same or IT is already exact, abort conversion!
|
||||
using EK = CGAL::Exact_predicates_exact_constructions_kernel;
|
||||
using ET = typename EK::FT;
|
||||
|
||||
using IK_to_EK = CGAL::Cartesian_converter<IK, EK>;
|
||||
using EK_to_IK = CGAL::Cartesian_converter<EK, IK>;
|
||||
|
||||
public:
|
||||
Kinetic_traits_3() :
|
||||
m_use_hybrid_mode(false) { }
|
||||
|
||||
inline const Point_2 intersection(const Line_2& t1, const Line_2& t2) const {
|
||||
|
||||
Point_2 out;
|
||||
const bool is_intersection_found = intersection(t1, t2, out);
|
||||
CGAL_assertion(is_intersection_found);
|
||||
return out;
|
||||
}
|
||||
|
||||
template<typename Type1, typename Type2, typename ResultType>
|
||||
inline bool intersection(
|
||||
const Type1& t1, const Type2& t2, ResultType& result) const {
|
||||
|
||||
const auto inter = intersection_impl(t1, t2);
|
||||
if (!inter) return false;
|
||||
if (const ResultType* typed_inter = boost::get<ResultType>(&*inter)) {
|
||||
result = *typed_inter;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
const bool m_use_hybrid_mode;
|
||||
IK_to_EK m_inexact_to_exact;
|
||||
EK_to_IK m_exact_to_inexact;
|
||||
|
||||
template<typename Type1, typename Type2>
|
||||
decltype(auto) intersection_impl(const Type1& t1, const Type2& t2) const {
|
||||
|
||||
// if (!m_use_hybrid_mode) {
|
||||
return CGAL::intersection(t1, t2);
|
||||
// } else { // convert to exact
|
||||
|
||||
// // TODO: It does not compile with EPECK as input kernel.
|
||||
// const auto exact_t1 = m_inexact_to_exact(t1);
|
||||
// const auto exact_t2 = m_inexact_to_exact(t2);
|
||||
// const auto exact_result = CGAL::intersection(exact_t1, exact_t2);
|
||||
// return m_exact_to_inexact(exact_result);
|
||||
// }
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace KSR
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_KSR_CONVERSIONS_H
|
||||
|
|
@ -24,19 +24,19 @@ struct Parameters_3 {
|
|||
unsigned int k = 1; // k intersections
|
||||
unsigned int n = 0; // n subdivisions, not implemented yet
|
||||
|
||||
FT enlarge_bbox_ratio = FT(11) / FT(10); // ratio to enlarge bbox
|
||||
FT distance_tolerance = FT(0.005) / FT(10); // distance tolerance between planes
|
||||
FT bbox_dilation_ratio = FT(11) / FT(10); // ratio to enlarge bbox
|
||||
FT angle_tolerance = FT(5);
|
||||
FT distance_tolerance = FT(5) / FT(10); // distance tolerance between planes
|
||||
|
||||
bool reorient = false; // true - optimal bounding box, false - axis aligned
|
||||
bool reorient_bbox = false; // true - optimal bounding box, false - axis aligned
|
||||
|
||||
// All files are saved in the current build directory.
|
||||
bool verbose = true; // print basic verbose information
|
||||
bool debug = false; // print all steps and substeps + export initial and final configurations
|
||||
bool export_all = false; // export all intermediate configurations and events
|
||||
|
||||
// See also global tolerance inside utils.h!
|
||||
Parameters_3(const bool v = true, const bool d = false, const bool e = false) :
|
||||
verbose(v), debug(d), export_all(e) { }
|
||||
Parameters_3(const bool v = true, const bool d = false) :
|
||||
verbose(v), debug(d) { }
|
||||
};
|
||||
|
||||
} // namespace KSR
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
#include <CGAL/KSR/utils.h>
|
||||
#include <CGAL/KSR/debug.h>
|
||||
#include <CGAL/KSR/parameters.h>
|
||||
#include <CGAL/KSR/conversions.h>
|
||||
|
||||
#include <CGAL/KSR_3/Support_plane.h>
|
||||
#include <CGAL/KSR_3/Intersection_graph.h>
|
||||
|
|
@ -35,40 +34,40 @@ namespace KSR_3 {
|
|||
#ifdef DOXYGEN_RUNNING
|
||||
#else
|
||||
|
||||
template<typename GeomTraits, typename Intersection_Traits>
|
||||
template<typename Traits>
|
||||
class Data_structure {
|
||||
|
||||
public:
|
||||
using Kernel = GeomTraits;
|
||||
using Intersection_Kernel = Intersection_Traits;
|
||||
using Kernel = typename Traits::Kernel;
|
||||
using Intersection_Kernel = typename Traits::Intersection_Kernel;
|
||||
|
||||
using Support_plane = KSR_3::Support_plane<Kernel, Intersection_Kernel>;
|
||||
using Intersection_graph = KSR_3::Intersection_graph<Kernel, Intersection_Kernel>;
|
||||
using Support_plane = KSR_3::Support_plane<Traits>;
|
||||
using Intersection_graph = KSR_3::Intersection_graph<Traits>;
|
||||
using FaceEvent = typename Support_plane::FaceEvent;
|
||||
|
||||
private:
|
||||
using FT = typename Kernel::FT;
|
||||
using Point_2 = typename Kernel::Point_2;
|
||||
using FT = typename Traits::FT;
|
||||
using Point_2 = typename Traits::Point_2;
|
||||
using IkPoint_2 = typename Intersection_Kernel::Point_2;
|
||||
using Point_3 = typename Kernel::Point_3;
|
||||
using Point_3 = typename Traits::Point_3;
|
||||
using IkPoint_3 = typename Intersection_Kernel::Point_3;
|
||||
using Segment_2 = typename Kernel::Segment_2;
|
||||
using Segment_2 = typename Traits::Segment_2;
|
||||
using IkSegment_2 = typename Intersection_Kernel::Segment_2;
|
||||
using Segment_3 = typename Kernel::Segment_3;
|
||||
using Segment_3 = typename Traits::Segment_3;
|
||||
using IkSegment_3 = typename Intersection_Kernel::Segment_3;
|
||||
using Vector_2 = typename Kernel::Vector_2;
|
||||
using Direction_2 = typename Kernel::Direction_2;
|
||||
using Vector_2 = typename Traits::Vector_2;
|
||||
using Direction_2 = typename Traits::Direction_2;
|
||||
using IkDirection_2 = typename Intersection_Kernel::Direction_2;
|
||||
using Triangle_2 = typename Kernel::Triangle_2;
|
||||
using Line_2 = typename Kernel::Line_2;
|
||||
using Line_2 = typename Traits::Line_2;
|
||||
using IkLine_2 = typename Intersection_Kernel::Line_2;
|
||||
using Plane_3 = typename Kernel::Plane_3;
|
||||
using Plane_3 = typename Traits::Plane_3;
|
||||
|
||||
using Polygon_2 = CGAL::Polygon_2<Kernel>;
|
||||
using Parameters = KSR::Parameters_3<FT>;
|
||||
|
||||
using To_exact = CGAL::Cartesian_converter<Kernel, Intersection_Kernel>;
|
||||
using From_exact = CGAL::Cartesian_converter<Intersection_Kernel, Kernel>;
|
||||
using To_exact = typename Traits::To_exact;
|
||||
using From_exact = typename Traits::From_exact;
|
||||
|
||||
public:
|
||||
using Mesh = typename Support_plane::Mesh;
|
||||
|
|
@ -185,6 +184,7 @@ public:
|
|||
|
||||
struct Volume_cell {
|
||||
std::vector<PFace> pfaces;
|
||||
std::vector<size_t> faces;// Indices into m_face2vertices in m_data.
|
||||
std::vector<bool> pface_oriented_outwards;
|
||||
std::vector<int> neighbors;
|
||||
std::set<PVertex> pvertices;
|
||||
|
|
@ -218,8 +218,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
using Kinetic_traits = KSR::Kinetic_traits_3<Kernel>;
|
||||
|
||||
private:
|
||||
std::map< std::pair<std::size_t, IEdge>, Point_2> m_points;
|
||||
std::map< std::pair<std::size_t, IEdge>, Vector_2> m_directions;
|
||||
|
|
@ -230,18 +228,29 @@ private:
|
|||
From_exact from_exact;
|
||||
|
||||
const Parameters& m_parameters;
|
||||
Kinetic_traits m_kinetic_traits;
|
||||
|
||||
std::vector<Volume_cell> m_volumes;
|
||||
std::map<PFace, std::pair<int, int> > m_map_volumes;
|
||||
std::vector<std::vector<std::size_t> > m_face2vertices;
|
||||
std::map<PFace, std::pair<int, int> > m_face2volumes;
|
||||
std::map<std::size_t, std::vector<std::size_t> > m_face2input_polygon;
|
||||
std::map<std::size_t, std::size_t> m_input_polygon_map;
|
||||
Reconstructed_model m_reconstructed_model;
|
||||
|
||||
template<typename Type1, typename Type2, typename ResultType>
|
||||
inline bool intersection(
|
||||
const Type1& t1, const Type2& t2, ResultType& result) const {
|
||||
|
||||
const auto inter = CGAL::intersection(t1, t2);
|
||||
if (!inter) return false;
|
||||
if (const ResultType* typed_inter = boost::get<ResultType>(&*inter)) {
|
||||
result = *typed_inter;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public:
|
||||
Data_structure(const Parameters& parameters) :
|
||||
m_parameters(parameters),
|
||||
m_kinetic_traits()
|
||||
{ }
|
||||
Data_structure(const Parameters& parameters) : m_parameters(parameters), to_exact(), from_exact() { }
|
||||
|
||||
/*******************************
|
||||
** INITIALIZATION **
|
||||
|
|
@ -254,7 +263,7 @@ public:
|
|||
m_intersection_graph.clear();
|
||||
|
||||
m_volumes.clear();
|
||||
m_map_volumes.clear();
|
||||
m_face2volumes.clear();
|
||||
m_input_polygon_map.clear();
|
||||
m_reconstructed_model.clear();
|
||||
}
|
||||
|
|
@ -299,8 +308,8 @@ public:
|
|||
** GENERAL **
|
||||
********************************/
|
||||
|
||||
std::map<PFace, std::pair<int, int> >& pface_neighbors() { return m_map_volumes; }
|
||||
const std::map<PFace, std::pair<int, int> >& pface_neighbors() const { return m_map_volumes; }
|
||||
std::map<PFace, std::pair<int, int> >& pface_neighbors() { return m_face2volumes; }
|
||||
const std::map<PFace, std::pair<int, int> >& pface_neighbors() const { return m_face2volumes; }
|
||||
|
||||
const std::vector<Support_plane>& support_planes() const { return m_support_planes; }
|
||||
std::vector<Support_plane>& support_planes() { return m_support_planes; }
|
||||
|
|
@ -568,6 +577,9 @@ public:
|
|||
std::vector<Volume_cell>& volumes() { return m_volumes; }
|
||||
const std::vector<Volume_cell>& volumes() const { return m_volumes; }
|
||||
|
||||
const std::vector<std::size_t> face(std::size_t face_index) const { return &m_face2vertices[face_index]; }
|
||||
const Point_3& vertex(std::size_t vertex_index) const { return &m_face2vertices[face_index]; }
|
||||
|
||||
Reconstructed_model& reconstructed_model() { return m_reconstructed_model; }
|
||||
const Reconstructed_model& reconstructed_model() const { return m_reconstructed_model; }
|
||||
|
||||
|
|
@ -604,7 +616,7 @@ public:
|
|||
const PointRange& polygon, const bool is_bbox) {
|
||||
|
||||
const Support_plane new_support_plane(
|
||||
polygon, is_bbox, m_parameters.distance_tolerance, number_of_support_planes());
|
||||
polygon, is_bbox, m_parameters.distance_tolerance, m_parameters.angle_tolerance, number_of_support_planes());
|
||||
std::size_t support_plane_idx = KSR::no_element();
|
||||
|
||||
for (std::size_t i = 0; i < number_of_support_planes(); ++i) {
|
||||
|
|
@ -644,9 +656,8 @@ public:
|
|||
for (const auto iedge : all_iedges) {
|
||||
const auto segment = segment_3(iedge);
|
||||
typename Intersection_graph::Edge_property* p = (typename Intersection_graph::Edge_property*)iedge.get_property();
|
||||
if (!m_kinetic_traits.intersection(plane, segment, point)) {
|
||||
if (!intersection(plane, segment, point))
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto isource = source(iedge);
|
||||
const auto itarget = target(iedge);
|
||||
|
|
|
|||
|
|
@ -29,21 +29,22 @@ namespace KSR_3 {
|
|||
#ifdef DOXYGEN_RUNNING
|
||||
#else
|
||||
|
||||
template<typename GeomTraits, typename Intersection_Kernel>
|
||||
template<typename Traits>
|
||||
class FacePropagation {
|
||||
|
||||
public:
|
||||
using Kernel = GeomTraits;
|
||||
using Kernel = typename Traits::Kernel;
|
||||
using Intersection_Kernel = typename Traits::Intersection_Kernel;
|
||||
|
||||
private:
|
||||
using FT = typename Kernel::FT;
|
||||
using Point_2 = typename Kernel::Point_2;
|
||||
using Vector_2 = typename Kernel::Vector_2;
|
||||
using Segment_2 = typename Kernel::Segment_2;
|
||||
using Direction_2 = typename Kernel::Direction_2;
|
||||
using Line_2 = typename Kernel::Line_2;
|
||||
using FT = typename Traits::FT;
|
||||
using Point_2 = typename Traits::Point_2;
|
||||
using Vector_2 = typename Traits::Vector_2;
|
||||
using Segment_2 = typename Traits::Segment_2;
|
||||
using Direction_2 = typename Traits::Direction_2;
|
||||
using Line_2 = typename Traits::Line_2;
|
||||
|
||||
using Data_structure = KSR_3::Data_structure<Kernel, Intersection_Kernel>;
|
||||
using Data_structure = KSR_3::Data_structure<Traits>;
|
||||
|
||||
using IVertex = typename Data_structure::IVertex;
|
||||
using IEdge = typename Data_structure::IEdge;
|
||||
|
|
@ -57,7 +58,6 @@ private:
|
|||
using Face_index = typename Data_structure::Face_index;
|
||||
|
||||
using Parameters = KSR::Parameters_3<FT>;
|
||||
using Kinetic_traits = KSR::Kinetic_traits_3<Kernel>;
|
||||
|
||||
using FaceEvent = typename Data_structure::Support_plane::FaceEvent;
|
||||
|
||||
|
|
@ -69,11 +69,11 @@ private:
|
|||
|
||||
public:
|
||||
FacePropagation(Data_structure& data, const Parameters& parameters) :
|
||||
m_data(data), m_parameters(parameters), m_kinetic_traits(),
|
||||
m_data(data), m_parameters(parameters),
|
||||
m_min_time(-FT(1)), m_max_time(-FT(1))
|
||||
{ }
|
||||
|
||||
const std::pair<std::size_t, std::size_t> propagate() {
|
||||
const std::pair<std::size_t, std::size_t> propagate(std::size_t k) {
|
||||
std::size_t num_queue_calls = 0;
|
||||
std::size_t num_events = 0;
|
||||
|
||||
|
|
@ -97,7 +97,6 @@ public:
|
|||
private:
|
||||
Data_structure& m_data;
|
||||
const Parameters& m_parameters;
|
||||
Kinetic_traits m_kinetic_traits;
|
||||
|
||||
FT m_min_time;
|
||||
FT m_max_time;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
#include <CGAL/KSR/utils.h>
|
||||
#include <CGAL/KSR/debug.h>
|
||||
#include <CGAL/KSR/parameters.h>
|
||||
#include <CGAL/KSR/conversions.h>
|
||||
|
||||
#include <CGAL/KSR_3/Data_structure.h>
|
||||
|
||||
|
|
@ -30,11 +29,11 @@ namespace KSR_3 {
|
|||
#ifdef DOXYGEN_RUNNING
|
||||
#else
|
||||
|
||||
template<typename GeomTraits, typename Intersection_Kernel>
|
||||
template<typename Traits>
|
||||
class Finalizer {
|
||||
|
||||
public:
|
||||
using Kernel = GeomTraits;
|
||||
using Kernel = typename Traits;
|
||||
|
||||
private:
|
||||
using FT = typename Kernel::FT;
|
||||
|
|
@ -48,7 +47,7 @@ private:
|
|||
using Direction_2 = typename Kernel::Direction_2;
|
||||
using Tetrahedron_3 = typename Kernel::Tetrahedron_3;
|
||||
|
||||
using Data_structure = KSR_3::Data_structure<Kernel, Intersection_Kernel>;
|
||||
using Data_structure = KSR_3::Data_structure<Traits>;
|
||||
|
||||
using IVertex = typename Data_structure::IVertex;
|
||||
using IEdge = typename Data_structure::IEdge;
|
||||
|
|
@ -91,11 +90,10 @@ private:
|
|||
};
|
||||
|
||||
using Parameters = KSR::Parameters_3<FT>;
|
||||
using Kinetic_traits = KSR::Kinetic_traits_3<Kernel>;
|
||||
|
||||
public:
|
||||
Finalizer(Data_structure& data, const Parameters& parameters) :
|
||||
m_data(data), m_parameters(parameters), m_kinetic_traits()
|
||||
m_data(data), m_parameters(parameters)
|
||||
{ }
|
||||
|
||||
void create_polyhedra() {
|
||||
|
|
@ -124,7 +122,6 @@ public:
|
|||
private:
|
||||
Data_structure& m_data;
|
||||
const Parameters& m_parameters;
|
||||
Kinetic_traits m_kinetic_traits;
|
||||
|
||||
/*******************************
|
||||
** EXTRACTING VOLUMES **
|
||||
|
|
|
|||
|
|
@ -38,20 +38,20 @@ namespace KSR_3 {
|
|||
#ifdef DOXYGEN_RUNNING
|
||||
#else
|
||||
|
||||
template<typename GeomTraits, typename Intersection_Traits>
|
||||
template<typename Traits>
|
||||
class Graphcut {
|
||||
|
||||
public:
|
||||
using Kernel = GeomTraits;
|
||||
using Intersection_Kernel = Intersection_Traits;
|
||||
using Kernel = typename Traits::Kernel;
|
||||
using Intersection_Kernel = typename Traits::Intersection_Kernel;
|
||||
|
||||
using FT = typename Kernel::FT;
|
||||
using Point_3 = typename Kernel::Point_3;
|
||||
using Triangle_2 = typename Kernel::Triangle_2;
|
||||
using Triangle_3 = typename Kernel::Triangle_3;
|
||||
using FT = typename Traits::FT;
|
||||
using Point_3 = typename Traits::Point_3;
|
||||
using Triangle_2 = typename Traits::Triangle_2;
|
||||
using Triangle_3 = typename Traits::Triangle_3;
|
||||
using Indices = std::vector<std::size_t>;
|
||||
|
||||
using Data_structure = KSR_3::Data_structure<Kernel, Intersection_Kernel>;
|
||||
using Data_structure = KSR_3::Data_structure<Traits>;
|
||||
using Mesh = typename Data_structure::Mesh;
|
||||
using Volume_cell = typename Data_structure::Volume_cell;
|
||||
using PFace = typename Data_structure::PFace;
|
||||
|
|
@ -60,8 +60,8 @@ namespace KSR_3 {
|
|||
|
||||
using Delaunay_2 = CGAL::Delaunay_triangulation_2<Kernel>;
|
||||
using Delaunay_3 = CGAL::Delaunay_triangulation_3<Kernel>;
|
||||
//using Converter = CGAL::Cartesian_converter<Kernel, IK>;
|
||||
using From_exact = CGAL::Cartesian_converter<Intersection_Kernel, Kernel>;
|
||||
|
||||
using From_exact = typename Traits::From_exact;
|
||||
|
||||
struct Wrapper {
|
||||
PFace pface;
|
||||
|
|
@ -333,7 +333,7 @@ namespace KSR_3 {
|
|||
for (std::size_t i = 0; i < 6; i++) {
|
||||
cost_matrix[0][i] = 100000000;
|
||||
}
|
||||
cost_matrix[0][0] = -100000000;
|
||||
//cost_matrix[0][0] = -100000000;
|
||||
|
||||
for (std::size_t i = 0; i < 6; i++) {
|
||||
cost_matrix[1][i] = -cost_matrix[0][i];
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
#include <CGAL/KSR/utils.h>
|
||||
#include <CGAL/KSR/debug.h>
|
||||
#include <CGAL/KSR/parameters.h>
|
||||
#include <CGAL/KSR/conversions.h>
|
||||
|
||||
#include <CGAL/KSR_3/Data_structure.h>
|
||||
|
||||
|
|
@ -40,25 +39,25 @@ namespace KSR_3 {
|
|||
#ifdef DOXYGEN_RUNNING
|
||||
#else
|
||||
|
||||
template<typename GeomTraits, typename Intersection_Traits>
|
||||
template<typename Traits>
|
||||
class Initializer {
|
||||
|
||||
public:
|
||||
using Kernel = GeomTraits;
|
||||
using Intersection_Kernel = Intersection_Traits;
|
||||
using Kernel = typename Traits::Kernel;
|
||||
using Intersection_Kernel = typename Traits::Intersection_Kernel;
|
||||
|
||||
private:
|
||||
using FT = typename Kernel::FT;
|
||||
using Point_2 = typename Kernel::Point_2;
|
||||
using Point_3 = typename Kernel::Point_3;
|
||||
using Vector_2 = typename Kernel::Vector_2;
|
||||
using Segment_2 = typename Kernel::Segment_2;
|
||||
using Segment_3 = typename Kernel::Segment_3;
|
||||
using Line_2 = typename Kernel::Line_2;
|
||||
using Transform_3 = typename Kernel::Aff_transformation_3;
|
||||
using Direction_2 = typename Kernel::Direction_2;
|
||||
using FT = typename Traits::FT;
|
||||
using Point_2 = typename Traits::Point_2;
|
||||
using Point_3 = typename Traits::Point_3;
|
||||
using Vector_2 = typename Traits::Vector_2;
|
||||
using Segment_2 = typename Traits::Segment_2;
|
||||
using Segment_3 = typename Traits::Segment_3;
|
||||
using Line_2 = typename Traits::Line_2;
|
||||
using Transform_3 = typename Traits::Transform_3;
|
||||
using Direction_2 = typename Traits::Direction_2;
|
||||
|
||||
using Data_structure = KSR_3::Data_structure<Kernel, Intersection_Kernel>;
|
||||
using Data_structure = KSR_3::Data_structure<Traits>;
|
||||
using Support_plane = typename Data_structure::Support_plane;
|
||||
using IEdge = typename Data_structure::IEdge;
|
||||
using IFace = typename Data_structure::IFace;
|
||||
|
|
@ -68,23 +67,21 @@ private:
|
|||
|
||||
using IVertex = typename Data_structure::IVertex;
|
||||
|
||||
using To_exact = CGAL::Cartesian_converter<Kernel, Intersection_Kernel>;
|
||||
using From_exact = CGAL::Cartesian_converter<Intersection_Kernel, Kernel>;
|
||||
using To_exact = typename Traits::To_exact;
|
||||
using From_exact = typename Traits::From_exact;
|
||||
|
||||
using Bbox_3 = CGAL::Bbox_3;
|
||||
using OBB_traits = CGAL::Oriented_bounding_box_traits_3<Kernel>;
|
||||
|
||||
using Planar_shape_type = KSR::Planar_shape_type;
|
||||
using Parameters = KSR::Parameters_3<FT>;
|
||||
using Kinetic_traits = KSR::Kinetic_traits_3<Kernel>;
|
||||
|
||||
using Timer = CGAL::Real_timer;
|
||||
|
||||
public:
|
||||
Initializer(Data_structure& data, const Parameters& parameters) :
|
||||
m_data(data), m_parameters(parameters),
|
||||
m_merge_type(Planar_shape_type::CONVEX_HULL),
|
||||
m_kinetic_traits()
|
||||
m_merge_type(Planar_shape_type::CONVEX_HULL)
|
||||
{ }
|
||||
|
||||
template<
|
||||
|
|
@ -98,8 +95,8 @@ public:
|
|||
std::array<Point_3, 8> bbox;
|
||||
create_bounding_box(
|
||||
input_range, polygon_map,
|
||||
m_parameters.enlarge_bbox_ratio,
|
||||
m_parameters.reorient, bbox);
|
||||
m_parameters.bbox_dilation_ratio,
|
||||
m_parameters.reorient_bbox, bbox);
|
||||
|
||||
const double time_to_bbox = timer.time();
|
||||
|
||||
|
|
@ -179,7 +176,6 @@ private:
|
|||
Data_structure& m_data;
|
||||
const Parameters& m_parameters;
|
||||
const Planar_shape_type m_merge_type;
|
||||
Kinetic_traits m_kinetic_traits;
|
||||
|
||||
template<
|
||||
typename InputRange,
|
||||
|
|
@ -1000,9 +996,9 @@ private:
|
|||
const auto& qj = merged[jp];
|
||||
const Segment_2 segment(pj, qj);
|
||||
Point_2 inter;
|
||||
const bool is_intersected =
|
||||
m_kinetic_traits.intersection(segment, edge, inter);
|
||||
if (is_intersected) return false;
|
||||
const bool is_intersected = intersection(segment, edge, inter);
|
||||
if (is_intersected)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
@ -1118,13 +1114,8 @@ private:
|
|||
typename Intersection_Kernel::Point_2 point;
|
||||
typename Intersection_Kernel::Segment_3 seg_a(m_data.point_3(it_a->second.first), m_data.point_3(it_a->second.second));
|
||||
typename Intersection_Kernel::Segment_3 seg_b(m_data.point_3(it_b->second.first), m_data.point_3(it_b->second.second));
|
||||
if (!m_kinetic_traits.intersection(
|
||||
m_data.to_2d(common_plane_idx, seg_a),
|
||||
m_data.to_2d(common_plane_idx, seg_b),
|
||||
point)) {
|
||||
|
||||
if (!intersection(m_data.to_2d(common_plane_idx, seg_a), m_data.to_2d(common_plane_idx, seg_b), point))
|
||||
continue;
|
||||
}
|
||||
|
||||
crossed_vertices.push_back(
|
||||
m_data.add_ivertex(m_data.to_3d(common_plane_idx, point), union_set));
|
||||
|
|
@ -1201,6 +1192,19 @@ private:
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Type1, typename Type2, typename ResultType>
|
||||
inline bool intersection(
|
||||
const Type1& t1, const Type2& t2, ResultType& result) const {
|
||||
|
||||
const auto inter = CGAL::intersection(t1, t2);
|
||||
if (!inter) return false;
|
||||
if (const ResultType* typed_inter = boost::get<ResultType>(&*inter)) {
|
||||
result = *typed_inter;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#endif //DOXYGEN_RUNNING
|
||||
|
|
|
|||
|
|
@ -31,19 +31,18 @@ namespace KSR_3 {
|
|||
#ifdef DOXYGEN_RUNNING
|
||||
#else
|
||||
|
||||
template<typename GeomTraits, typename Intersection_Traits>
|
||||
template<typename Traits>
|
||||
class Intersection_graph {
|
||||
|
||||
public:
|
||||
using Kernel = GeomTraits;
|
||||
using Interxsection_Kernel = Intersection_Traits;
|
||||
using Kernel = typename Traits::Kernel;
|
||||
using Intersection_Kernel = typename Traits::Intersection_Kernel;
|
||||
|
||||
using FT = typename Intersection_Traits::FT;
|
||||
using Point_2 = typename Intersection_Traits::Point_2;
|
||||
using Point_3 = typename Intersection_Traits::Point_3;
|
||||
using Segment_3 = typename Intersection_Traits::Segment_3;
|
||||
using Line_3 = typename Intersection_Traits::Line_3;
|
||||
using Polygon_2 = typename CGAL::Polygon_2<Intersection_Traits>;
|
||||
using Point_2 = typename Traits::IK_Point_2;
|
||||
using Point_3 = typename Traits::IK_Point_3;
|
||||
using Segment_3 = typename Traits::IK_Segment_3;
|
||||
using Line_3 = typename Traits::IK_Line_3;
|
||||
using Polygon_2 = typename CGAL::Polygon_2<Point_2>;
|
||||
|
||||
using Inexact_FT = typename Kernel::FT;
|
||||
|
||||
|
|
@ -106,7 +105,7 @@ public:
|
|||
Face_property(std::size_t support_plane_idx) : support_plane(support_plane_idx), part_of_partition(false) {}
|
||||
std::size_t support_plane;
|
||||
bool part_of_partition;
|
||||
CGAL::Polygon_2<Interxsection_Kernel> poly;
|
||||
CGAL::Polygon_2<Intersection_Kernel> poly;
|
||||
std::vector<Point_2> pts;
|
||||
std::vector<Edge_descriptor> edges;
|
||||
std::vector<Vertex_descriptor> vertices;
|
||||
|
|
@ -371,7 +370,7 @@ public:
|
|||
void set_crossed(const Edge_descriptor& edge, std::size_t sp_idx) { m_graph[edge].crossed.insert(sp_idx); }
|
||||
};
|
||||
|
||||
template<typename GeomTraits, typename Intersection_Traits> std::size_t Intersection_graph<GeomTraits, Intersection_Traits>::Edge_property::edge_counter = 0;
|
||||
template<typename Traits> std::size_t Intersection_graph<Traits>::Edge_property::edge_counter = 0;
|
||||
|
||||
#endif //DOXYGEN_RUNNING
|
||||
|
||||
|
|
|
|||
|
|
@ -46,8 +46,11 @@ namespace CGAL {
|
|||
|
||||
\tparam IntersectionKernel
|
||||
must be a model of `Kernel`. Is used for the creation of the intersection graph. An exact kernel is suggested.
|
||||
|
||||
\tparam InputRange
|
||||
must be a model of `ConstRange` whose iterator type is `RandomAccessIterator`.
|
||||
*/
|
||||
template<Kernel, Intersection_Kernel>
|
||||
template<Kernel, Intersection_Kernel, InputRange>
|
||||
class Kinetic_reconstruction_3 {
|
||||
public:
|
||||
/*!
|
||||
|
|
@ -267,34 +270,30 @@ public:
|
|||
#else
|
||||
|
||||
namespace KSR_3 {
|
||||
template<
|
||||
typename InputRange,
|
||||
typename PointMap,
|
||||
typename VectorMap,
|
||||
typename SemanticMap,
|
||||
typename GeomTraits,
|
||||
typename Intersection_Kernel>
|
||||
template<typename Traits,
|
||||
typename SemanticMap>
|
||||
class Reconstruction {
|
||||
|
||||
public:
|
||||
using Input_range = InputRange;
|
||||
using Point_map = PointMap;
|
||||
using Vector_map = VectorMap;
|
||||
using Kernel = typename Traits::Kernel;
|
||||
using Intersection_Kernel = typename Traits::Intersection_Kernel;
|
||||
using Input_range = typename Traits::Input_range;
|
||||
using Point_map = typename Traits::Point_map;
|
||||
using Vector_map = typename Traits::Normal_map;
|
||||
using Semantic_map = SemanticMap;
|
||||
using Kernel = GeomTraits;
|
||||
|
||||
private:
|
||||
using FT = typename Kernel::FT;
|
||||
using Point_2 = typename Kernel::Point_2;
|
||||
using Line_2 = typename Kernel::Line_2;
|
||||
using Point_3 = typename Kernel::Point_3;
|
||||
using Plane_3 = typename Kernel::Plane_3;
|
||||
using Vector_2 = typename Kernel::Vector_2;
|
||||
using Vector_3 = typename Kernel::Vector_3;
|
||||
using Segment_2 = typename Kernel::Segment_2;
|
||||
using Segment_3 = typename Kernel::Segment_3;
|
||||
using FT = typename Traits::FT;
|
||||
using Point_2 = typename Traits::Point_2;
|
||||
using Line_2 = typename Traits::Line_2;
|
||||
using Point_3 = typename Traits::Point_3;
|
||||
using Plane_3 = typename Traits::Plane_3;
|
||||
using Vector_2 = typename Traits::Vector_2;
|
||||
using Vector_3 = typename Traits::Vector_3;
|
||||
using Segment_2 = typename Traits::Segment_2;
|
||||
using Segment_3 = typename Traits::Segment_3;
|
||||
|
||||
using Data_structure = KSR_3::Data_structure<Kernel, Intersection_Kernel>;
|
||||
using Data_structure = KSR_3::Data_structure<Traits>;
|
||||
using PFace = typename Data_structure::PFace;
|
||||
|
||||
using Point_map_3 = KSR::Item_property_map<Input_range, Point_map>;
|
||||
|
|
@ -309,7 +308,7 @@ private:
|
|||
using Polygon_3 = std::vector<Point_3>;
|
||||
using Polygon_map = CGAL::Identity_property_map<Polygon_3>;
|
||||
|
||||
using From_EK = CGAL::Cartesian_converter<Intersection_Kernel, Kernel>;
|
||||
using From_EK = typename Traits::From_exact;
|
||||
|
||||
struct Vertex_info { FT z = FT(0); };
|
||||
struct Face_info { };
|
||||
|
|
@ -360,8 +359,8 @@ private:
|
|||
Region_growing<Points_2, Neighbor_query_2, Linear_region, typename Linear_sorting::Seed_map>;
|
||||
|
||||
using Visibility_label = KSR::Visibility_label;
|
||||
using Visibility = KSR_3::Visibility<Kernel, Intersection_Kernel, Point_map_3, Vector_map_3>;
|
||||
using Graphcut = KSR_3::Graphcut<Kernel, Intersection_Kernel>;
|
||||
using Visibility = KSR_3::Visibility<Traits>;
|
||||
using Graphcut = KSR_3::Graphcut<Traits>;
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -954,7 +953,7 @@ private:
|
|||
for (const auto& indices : result) {
|
||||
region.clear();
|
||||
for (const std::size_t index : indices) {
|
||||
region.push_back(input_range[index]);
|
||||
region.push_back(index);
|
||||
}
|
||||
regions.push_back(region);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,30 +29,30 @@ namespace KSR_3 {
|
|||
#ifdef DOXYGEN_RUNNING
|
||||
#else
|
||||
|
||||
template<typename GeomTraits, typename Intersection_Traits>
|
||||
template<typename Traits>
|
||||
class Support_plane {
|
||||
|
||||
public:
|
||||
using Kernel = GeomTraits;
|
||||
using Intersection_Kernel = Intersection_Traits;
|
||||
using Kernel = typename Traits::Kernel;
|
||||
using Intersection_Kernel = typename Traits::Intersection_Kernel;
|
||||
using To_exact = CGAL::Cartesian_converter<Kernel, Intersection_Kernel>;
|
||||
using From_exact = CGAL::Cartesian_converter<Intersection_Kernel, Kernel>;
|
||||
|
||||
using FT = typename Kernel::FT;
|
||||
using Point_2 = typename Kernel::Point_2;
|
||||
using Point_3 = typename Kernel::Point_3;
|
||||
using Vector_2 = typename Kernel::Vector_2;
|
||||
using Vector_3 = typename Kernel::Vector_3;
|
||||
using Direction_2 = typename Kernel::Direction_2;
|
||||
using Segment_2 = typename Kernel::Segment_2;
|
||||
using Segment_3 = typename Kernel::Segment_3;
|
||||
using Line_2 = typename Kernel::Line_2;
|
||||
using Line_3 = typename Kernel::Line_3;
|
||||
using Plane_3 = typename Kernel::Plane_3;
|
||||
using Triangle_2 = typename Kernel::Triangle_2;
|
||||
using FT = typename Traits::FT;
|
||||
using Point_2 = typename Traits::Point_2;
|
||||
using Point_3 = typename Traits::Point_3;
|
||||
using Vector_2 = typename Traits::Vector_2;
|
||||
using Vector_3 = typename Traits::Vector_3;
|
||||
using Direction_2 = typename Traits::Direction_2;
|
||||
using Segment_2 = typename Traits::Segment_2;
|
||||
using Segment_3 = typename Traits::Segment_3;
|
||||
using Line_2 = typename Traits::Line_2;
|
||||
using Line_3 = typename Traits::Line_3;
|
||||
using Plane_3 = typename Traits::Plane_3;
|
||||
using Triangle_2 = typename Traits::Triangle_2;
|
||||
|
||||
using Mesh = CGAL::Surface_mesh<Point_2>;
|
||||
using Intersection_graph = KSR_3::Intersection_graph<Kernel, Intersection_Kernel>;
|
||||
using Intersection_graph = KSR_3::Intersection_graph<Traits>;
|
||||
using Bbox_2 = CGAL::Bbox_2;
|
||||
|
||||
using IVertex = typename Intersection_graph::Vertex_descriptor;
|
||||
|
|
@ -113,8 +113,11 @@ private:
|
|||
std::vector<Vector_2> original_vectors;
|
||||
std::vector<Direction_2> original_directions;
|
||||
std::vector<typename Intersection_Kernel::Ray_2> original_rays;
|
||||
int k;
|
||||
|
||||
FT distance_tolerance;
|
||||
FT angle_tolerance;
|
||||
|
||||
int k;
|
||||
};
|
||||
|
||||
std::shared_ptr<Data> m_data;
|
||||
|
|
@ -126,7 +129,7 @@ public:
|
|||
}
|
||||
|
||||
template<typename PointRange>
|
||||
Support_plane(const PointRange& polygon, const bool is_bbox, const FT distance_tolerance, std::size_t idx) :
|
||||
Support_plane(const PointRange& polygon, const bool is_bbox, const FT distance_tolerance, const FT angle_tolerance, std::size_t idx) :
|
||||
m_data(std::make_shared<Data>()) {
|
||||
To_exact to_EK;
|
||||
|
||||
|
|
@ -159,6 +162,7 @@ public:
|
|||
m_data->exact_plane = to_EK(m_data->plane);
|
||||
m_data->is_bbox = is_bbox;
|
||||
m_data->distance_tolerance = distance_tolerance;
|
||||
m_data->angle_tolerance = angle_tolerance;
|
||||
|
||||
std::vector<Triangle_2> tris(points.size() - 2);
|
||||
for (std::size_t i = 2; i < points.size(); i++) {
|
||||
|
|
@ -279,6 +283,10 @@ public:
|
|||
return m_data->distance_tolerance;
|
||||
}
|
||||
|
||||
FT angle_tolerance() const {
|
||||
return m_data->angle_tolerance;
|
||||
}
|
||||
|
||||
void clear_pfaces() {
|
||||
m_data->mesh.clear();
|
||||
add_property_maps();
|
||||
|
|
@ -756,14 +764,14 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
template<typename Kernel, typename Intersection_Kernel>
|
||||
bool operator==(const Support_plane<Kernel, Intersection_Kernel>& a, const Support_plane<Kernel, Intersection_Kernel>& b) {
|
||||
template<typename Traits>
|
||||
bool operator==(const Support_plane<Traits>& a, const Support_plane<Traits>& b) {
|
||||
|
||||
if (a.is_bbox() || b.is_bbox()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
using FT = typename Kernel::FT;
|
||||
using FT = typename Traits::FT;
|
||||
const auto& planea = a.plane();
|
||||
const auto& planeb = b.plane();
|
||||
|
||||
|
|
@ -779,24 +787,15 @@ bool operator==(const Support_plane<Kernel, Intersection_Kernel>& a, const Suppo
|
|||
// return false;
|
||||
// }
|
||||
|
||||
const FT vtol = FT(5); // degrees // TODO: We should put it as a parameter.
|
||||
FT aval = approximate_angle(va, vb);
|
||||
CGAL_assertion(aval >= FT(0) && aval <= FT(180));
|
||||
if (aval >= FT(90)) aval = FT(180) - aval;
|
||||
if (aval >= FT(90))
|
||||
aval = FT(180) - aval;
|
||||
|
||||
// std::cout << "aval: " << aval << " : " << vtol << std::endl;
|
||||
if (aval >= vtol) {
|
||||
if (aval >= a.angle_tolerance()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Are the planes coplanar?
|
||||
// const FT ptol = KSR::point_tolerance<FT>();
|
||||
// const auto pa = planea.point();
|
||||
// const auto pb = planeb.projection(pa);
|
||||
// const FT bval = KSR::distance(pa, pb);
|
||||
|
||||
// TODO: We should put it as a parameter.
|
||||
const FT ptol = a.distance_tolerance();
|
||||
const auto pa1 = a.to_3d(a.centroid());
|
||||
const auto pb1 = planeb.projection(pa1);
|
||||
const auto pb2 = b.to_3d(b.centroid());
|
||||
|
|
@ -807,14 +806,9 @@ bool operator==(const Support_plane<Kernel, Intersection_Kernel>& a, const Suppo
|
|||
const FT bval = (CGAL::max)(bval1, bval2);
|
||||
CGAL_assertion(bval >= FT(0));
|
||||
|
||||
// if (bval < ptol) {
|
||||
// std::cout << "2 " << pa << " " << pb << std::endl;
|
||||
// std::cout << "bval: " << bval << " : " << ptol << std::endl;
|
||||
// }
|
||||
if (bval >= a.distance_tolerance())
|
||||
return false;
|
||||
|
||||
// std::cout << "bval: " << bval << " : " << ptol << std::endl;
|
||||
if (bval >= ptol) return false;
|
||||
// std::cout << "- found coplanar planes" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,47 +36,42 @@ namespace KSR_3 {
|
|||
#ifdef DOXYGEN_RUNNING
|
||||
#else
|
||||
|
||||
template<
|
||||
typename GeomTraits,
|
||||
typename Intersection_Traits,
|
||||
typename PointMap_3,
|
||||
typename VectorMap_3>
|
||||
template<typename Traits>
|
||||
class Visibility {
|
||||
|
||||
public:
|
||||
using Kernel = GeomTraits;
|
||||
using Intersection_Kernel = Intersection_Traits;
|
||||
using Point_map_3 = PointMap_3;
|
||||
using Vector_map_3 = VectorMap_3;
|
||||
using Kernel = typename Traits::Kernel;
|
||||
using Intersection_Kernel = typename Traits::Intersection_Kernel;
|
||||
using Point_map_3 = typename Traits::Point_map;
|
||||
using Vector_map_3 = typename Traits::Normal_map;
|
||||
|
||||
using FT = typename Kernel::FT;
|
||||
using Point_3 = typename Kernel::Point_3;
|
||||
using Vector_3 = typename Kernel::Vector_3;
|
||||
using FT = typename Traits::FT;
|
||||
using Point_3 = typename Traits::Point_3;
|
||||
using Vector_3 = typename Traits::Vector_3;
|
||||
using Indices = std::vector<std::size_t>;
|
||||
|
||||
using Data_structure = KSR_3::Data_structure<Kernel, Intersection_Kernel>;
|
||||
using Data_structure = KSR_3::Data_structure<Traits>;
|
||||
using PFace = typename Data_structure::PFace;
|
||||
using Volume_cell = typename Data_structure::Volume_cell;
|
||||
|
||||
using Delaunay_3 = CGAL::Delaunay_triangulation_3<Kernel>;
|
||||
using Generator = CGAL::Random_points_in_tetrahedron_3<Point_3>;
|
||||
|
||||
using From_EK = CGAL::Cartesian_converter<Intersection_Kernel, Kernel>;
|
||||
using From_EK = typename Traits::From_exact;
|
||||
|
||||
using Visibility_label = KSR::Visibility_label;
|
||||
|
||||
Visibility(
|
||||
const Data_structure& data,
|
||||
const std::map<PFace, Indices>& pface_points,
|
||||
const std::map<std::size_t, Indices>& face2points,
|
||||
const Point_map_3& point_map_3,
|
||||
const Vector_map_3& normal_map_3) :
|
||||
m_data(data),
|
||||
m_pface_points(pface_points),
|
||||
m_face2points(face2points),
|
||||
m_point_map_3(point_map_3),
|
||||
m_normal_map_3(normal_map_3),
|
||||
m_num_samples(0),
|
||||
m_random(0) {
|
||||
CGAL_assertion(m_pface_points.size() > 0);
|
||||
m_num_samples(0) {
|
||||
CGAL_assertion(m_face2points.size() > 0);
|
||||
m_inliers = 0;
|
||||
for (const auto pair : m_pface_points) {
|
||||
m_inliers += pair.second.size();
|
||||
|
|
@ -116,12 +111,11 @@ namespace KSR_3 {
|
|||
|
||||
private:
|
||||
const Data_structure& m_data;
|
||||
const std::map<PFace, Indices>& m_pface_points;
|
||||
const std::map<std::size_t, Indices>& m_face2points;
|
||||
const Point_map_3& m_point_map_3;
|
||||
const Vector_map_3& m_normal_map_3;
|
||||
mutable std::size_t m_num_samples;
|
||||
mutable std::size_t m_inliers;
|
||||
Random m_random;
|
||||
|
||||
void estimate_volume_label(Volume_cell& volume) const {
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -1,14 +1,7 @@
|
|||
#include <CGAL/Simple_cartesian.h>
|
||||
using SC = CGAL::Simple_cartesian<double>;
|
||||
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
using EPECK = CGAL::Exact_predicates_exact_constructions_kernel;
|
||||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||
|
||||
#include <CGAL/Cartesian_converter.h>
|
||||
using EPECK_to_EPICK = CGAL::Cartesian_converter<EPECK, EPICK>;
|
||||
|
||||
#include <CGAL/Random.h>
|
||||
#include <CGAL/Real_timer.h>
|
||||
|
|
@ -16,6 +9,11 @@ using EPECK_to_EPICK = CGAL::Cartesian_converter<EPECK, EPICK>;
|
|||
#include <CGAL/Aff_transformation_2.h>
|
||||
#include <CGAL/Kinetic_shape_reconstruction_2.h>
|
||||
|
||||
using SC = CGAL::Simple_cartesian<double>;
|
||||
using EPECK = CGAL::Exact_predicates_exact_constructions_kernel;
|
||||
using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||
using EPECK_to_EPICK = CGAL::Cartesian_converter<EPECK, EPICK>;
|
||||
|
||||
using FT = typename EPECK::FT;
|
||||
using Point_2 = typename EPECK::Point_2;
|
||||
using Vector_2 = typename EPECK::Vector_2;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Kinetic_shape_reconstruction_3.h>
|
||||
#include <CGAL/Kinetic_shape_partitioning_3.h>
|
||||
#include <CGAL/Real_timer.h>
|
||||
#include <CGAL/IO/OFF.h>
|
||||
#include <CGAL/IO/PLY.h>
|
||||
|
|
@ -12,6 +12,8 @@ using EPICK = CGAL::Exact_predicates_inexact_constructions_kernel;
|
|||
using EPECK = CGAL::Exact_predicates_exact_constructions_kernel;
|
||||
using Timer = CGAL::Real_timer;
|
||||
|
||||
using Traits = typename CGAL::Kinetic_shape_partitioning_Traits_3<EPICK, EPECK, std::vector<typename EPICK::Point_3>, CGAL::Identity_property_map<typename EPICK::Point_3> >;
|
||||
|
||||
template<typename Point>
|
||||
struct Polygon_map {
|
||||
|
||||
|
|
@ -48,11 +50,11 @@ bool run_test(
|
|||
std::vector< std::vector<double> >& all_times,
|
||||
std::size_t& num_tests) {
|
||||
|
||||
using Point_3 = typename Traits::Point_3;
|
||||
using Segment_3 = typename Traits::Segment_3;
|
||||
using Point_3 = typename Traits::Kernel::Point_3;
|
||||
using Segment_3 = typename Traits::Kernel::Segment_3;
|
||||
|
||||
using Surface_mesh = CGAL::Surface_mesh<Point_3>;
|
||||
using KSR = CGAL::Kinetic_shape_reconstruction_3<Traits>;
|
||||
using KSP = CGAL::Kinetic_shape_partitioning_3<Traits>;
|
||||
|
||||
++num_tests;
|
||||
std::string baseDir = "C:/dev/kinetic/Kinetic_shape_reconstruction/examples/Kinetic_shape_reconstruction/";
|
||||
|
|
@ -83,34 +85,35 @@ bool run_test(
|
|||
double time = 0.0;
|
||||
for (std::size_t iter = 0; iter < num_iters; ++iter) {
|
||||
std::cout << std::endl << "--ITERATION #" << iter + 1 << " BEGIN!" << std::endl;
|
||||
KSR ksr(true, true); // first verbose, second debug
|
||||
KSP ksp(true, false); // first verbose, second debug
|
||||
|
||||
// Running KSR.
|
||||
Timer timer;
|
||||
timer.start();
|
||||
const bool is_ksr_success = ksr.partition(
|
||||
input_faces, polygon_map, CGAL::parameters::k_intersections(k));
|
||||
assert(is_ksr_success);
|
||||
if (!is_ksr_success) return false;
|
||||
|
||||
bool is_ksp_success = ksp.initialize(
|
||||
input_faces, polygon_map);
|
||||
|
||||
if (is_ksp_success)
|
||||
ksp.partition(k);
|
||||
|
||||
assert(is_ksp_success);
|
||||
if (!is_ksp_success) return false;
|
||||
timer.stop();
|
||||
time += timer.time();
|
||||
|
||||
// Testing results.
|
||||
const std::size_t num_events = ksr.number_of_events();
|
||||
assert(num_events > 0);
|
||||
|
||||
const int num_support_planes = ksr.number_of_support_planes();
|
||||
const int num_support_planes = ksp.number_of_support_planes();
|
||||
|
||||
const int num_vertices = static_cast<int>(ksr.number_of_vertices());
|
||||
const int num_edges = static_cast<int>(ksr.number_of_edges());
|
||||
const int num_faces = static_cast<int>(ksr.number_of_faces());
|
||||
const int num_volumes = static_cast<int>(ksr.number_of_volumes());
|
||||
const int num_vertices = static_cast<int>(ksp.number_of_vertices());
|
||||
const int num_faces = static_cast<int>(ksp.number_of_faces());
|
||||
const int num_volumes = static_cast<int>(ksp.number_of_volumes());
|
||||
|
||||
std::cout << std::endl << "--RESULTS: ";
|
||||
std::cout << num_support_planes << ",";
|
||||
|
||||
std::cout << num_vertices << ",";
|
||||
std::cout << num_edges << ",";
|
||||
std::cout << num_faces << ",";
|
||||
std::cout << num_volumes << std::endl;
|
||||
|
||||
|
|
@ -136,14 +139,14 @@ bool run_test(
|
|||
if (num_volumes < results[5]) return false;*/
|
||||
|
||||
CGAL::Linear_cell_complex_for_combinatorial_map<3, 3> lcc;
|
||||
ksr.get_linear_cell_complex(lcc);
|
||||
|
||||
ksp.get_linear_cell_complex(lcc);
|
||||
/*
|
||||
std::vector<Point_3> output_vertices;
|
||||
ksr.output_partition_vertices(
|
||||
ksp.output_partition_vertices(
|
||||
std::back_inserter(output_vertices));
|
||||
assert(static_cast<std::size_t>(num_vertices) == output_vertices.size());
|
||||
if (static_cast<std::size_t>(num_vertices) != output_vertices.size()) return false;
|
||||
/*
|
||||
|
||||
|
||||
std::vector<Segment_3> output_edges;
|
||||
ksr.output_partition_edges(
|
||||
|
|
@ -163,18 +166,16 @@ bool run_test(
|
|||
assert(static_cast<std::size_t>(num_volumes) == output_volumes.size());
|
||||
if (static_cast<std::size_t>(num_volumes) != output_volumes.size()) return false;*/
|
||||
|
||||
ksr.clear();
|
||||
assert(ksr.number_of_support_planes() == 0);
|
||||
assert(ksr.number_of_vertices() == 0);
|
||||
assert(ksr.number_of_edges() == 0);
|
||||
assert(ksr.number_of_faces() == 0);
|
||||
assert(ksr.number_of_volumes() == 0);
|
||||
ksp.clear();
|
||||
assert(ksp.number_of_support_planes() == 0);
|
||||
assert(ksp.number_of_vertices() == 0);
|
||||
assert(ksp.number_of_faces() == 0);
|
||||
assert(ksp.number_of_volumes() == 0);
|
||||
|
||||
if (ksr.number_of_support_planes() != 0) return false;
|
||||
if (ksr.number_of_vertices() != 0) return false;
|
||||
if (ksr.number_of_edges() != 0) return false;
|
||||
if (ksr.number_of_faces() != 0) return false;
|
||||
if (ksr.number_of_volumes() != 0) return false;
|
||||
if (ksp.number_of_support_planes() != 0) return false;
|
||||
if (ksp.number_of_vertices() != 0) return false;
|
||||
if (ksp.number_of_faces() != 0) return false;
|
||||
if (ksp.number_of_volumes() != 0) return false;
|
||||
|
||||
std::cout << std::endl << "--ITERATION #" << iter + 1 << " END!" << std::endl;
|
||||
}
|
||||
|
|
@ -202,19 +203,18 @@ void run_all_tests() {
|
|||
// Number of allowed intersections k.
|
||||
std::vector<unsigned int> ks;
|
||||
for (unsigned int k = 1; k <= 6; ++k) {
|
||||
//ks.push_back(k);
|
||||
ks.push_back(k);
|
||||
}
|
||||
ks.push_back(3);
|
||||
//results = { 9,1,28,56,35,6 };
|
||||
//run_test<Traits>("data/stress-test-1/test-8-rnd-polygons-3-4.off", ks, num_iters, results, all_times, num_tests);
|
||||
//results = { 16,1,133,315,212,34 };
|
||||
//run_test<Traits>("data/real-data-test/test-10-polygons.off", ks, num_iters, results, all_times, num_tests);
|
||||
//results = { 10,1,37,77,46,6 };
|
||||
//run_test<Traits>("data/stress-test-4/test-4-rnd-polygons-4-6.off", ks, num_iters, results, all_times, num_tests);
|
||||
//results = { 10,1,37,77,46,6 };
|
||||
//assert(run_test<Traits>("data/edge-case-test/test-box.off", ks, num_iters, results, all_times, num_tests));
|
||||
//results = {7,1,12,20,11,2};
|
||||
//assert(run_test<Traits>("data/edge-case-test/test-flat-bbox-xy-split.off", ks, num_iters, results, all_times, num_tests));
|
||||
results = { 9,1,28,56,35,6 };
|
||||
run_test<Traits>("data/stress-test-1/test-8-rnd-polygons-3-4.off", ks, num_iters, results, all_times, num_tests);
|
||||
results = { 16,1,133,315,212,34 };
|
||||
run_test<Traits>("data/real-data-test/test-10-polygons.off", ks, num_iters, results, all_times, num_tests);
|
||||
results = { 10,1,37,77,46,6 };
|
||||
run_test<Traits>("data/stress-test-4/test-4-rnd-polygons-4-6.off", ks, num_iters, results, all_times, num_tests);
|
||||
results = { 10,1,37,77,46,6 };
|
||||
run_test<Traits>("data/edge-case-test/test-box.off", ks, num_iters, results, all_times, num_tests);
|
||||
results = {7,1,12,20,11,2};
|
||||
run_test<Traits>("data/edge-case-test/test-flat-bbox-xy-split.off", ks, num_iters, results, all_times, num_tests);
|
||||
|
||||
// Edge case tests.
|
||||
|
||||
|
|
@ -419,12 +419,14 @@ void run_all_tests() {
|
|||
}
|
||||
}
|
||||
|
||||
const auto kernel_name = boost::typeindex::type_id<Traits>().pretty_name();
|
||||
const auto kernel_name = boost::typeindex::type_id<typename Traits::Kernel>().pretty_name();
|
||||
const auto intersection_kernel_name = boost::typeindex::type_id<typename Traits::Intersection_Kernel>().pretty_name();
|
||||
if (num_tests != 0) {
|
||||
std::cout << std::endl << kernel_name <<
|
||||
std::cout << std::endl << kernel_name << " with " << intersection_kernel_name << " intersections" <<
|
||||
": ALL " << num_tests << " TESTS SUCCESS!" << std::endl << std::endl;
|
||||
} else {
|
||||
std::cout << std::endl << kernel_name <<
|
||||
}
|
||||
else {
|
||||
std::cout << std::endl << kernel_name << " with " << intersection_kernel_name << " intersections" <<
|
||||
": ALL " << num_tests << " TESTS FAILED!" << std::endl << std::endl;
|
||||
}
|
||||
}
|
||||
|
|
@ -438,6 +440,6 @@ int main(const int /* argc */, const char** /* argv */) {
|
|||
|
||||
// Passes all tests except for those when
|
||||
// intersections lead to accumulated errors.
|
||||
run_all_tests<EPICK>();
|
||||
run_all_tests<Traits>();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -251,12 +251,10 @@ CGAL_add_named_parameter(overlap_t, overlap, overlap)
|
|||
CGAL_add_named_parameter(maximum_normal_deviation_t, maximum_normal_deviation, maximum_normal_deviation)
|
||||
|
||||
// kinetic parameters
|
||||
CGAL_add_named_parameter(k_intersections_t, k_intersections, k_intersections)
|
||||
CGAL_add_named_parameter(n_subdivisions_t, n_subdivisions, n_subdivisions)
|
||||
CGAL_add_named_parameter(enlarge_bbox_ratio_t, enlarge_bbox_ratio, enlarge_bbox_ratio)
|
||||
CGAL_add_named_parameter(reorient_t, reorient, reorient)
|
||||
CGAL_add_named_parameter(use_hybrid_mode_t, use_hybrid_mode, use_hybrid_mode)
|
||||
CGAL_add_named_parameter(bbox_dilation_ratio_t, bbox_dilation_ratio, bbox_dilation_ratio)
|
||||
CGAL_add_named_parameter(reorient_bbox_t, reorient_bbox, reorient_bbox)
|
||||
CGAL_add_named_parameter(distance_tolerance_t, distance_tolerance, distance_tolerance)
|
||||
CGAL_add_named_parameter(angle_tolerance_t, angle_tolerance, angle_tolerance)
|
||||
|
||||
// region growing
|
||||
CGAL_add_named_parameter(k_neighbors_t, k_neighbors, k_neighbors)
|
||||
|
|
|
|||
Loading…
Reference in New Issue