mirror of https://github.com/CGAL/cgal
removing debug code
fixing bugs for Kinetic_space_partition<EPECK,EPECK> use oriented_side now uses exact calculations
This commit is contained in:
parent
91921020e1
commit
e9ed069a97
|
|
@ -26,8 +26,6 @@
|
||||||
#include <CGAL/KSP_3/Support_plane.h>
|
#include <CGAL/KSP_3/Support_plane.h>
|
||||||
#include <CGAL/KSP_3/Intersection_graph.h>
|
#include <CGAL/KSP_3/Intersection_graph.h>
|
||||||
|
|
||||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
namespace KSP_3 {
|
namespace KSP_3 {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
@ -247,13 +245,6 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Data_structure(const Parameters& parameters, const std::string &prefix) : to_exact(), from_exact(), m_parameters(parameters), m_prefix(prefix) {
|
Data_structure(const Parameters& parameters, const std::string &prefix) : to_exact(), from_exact(), m_parameters(parameters), m_prefix(prefix) {
|
||||||
bool k = std::is_same_v<Exact_predicates_exact_constructions_kernel, Intersection_kernel>;
|
|
||||||
std::string kern = k ? "EPECK" : "GMPQ";
|
|
||||||
#if _DEBUG
|
|
||||||
eventlog = std::ofstream("propagation_dbg" + kern + ".txt");
|
|
||||||
#else
|
|
||||||
eventlog = std::ofstream("propagation_rel" + kern + ".txt");
|
|
||||||
#endif
|
|
||||||
eventlog << std::setprecision(17);
|
eventlog << std::setprecision(17);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1088,14 +1079,15 @@ public:
|
||||||
|
|
||||||
template<typename Pair>
|
template<typename Pair>
|
||||||
void sort_points_by_direction(std::vector<Pair>& points) const {
|
void sort_points_by_direction(std::vector<Pair>& points) const {
|
||||||
FT x = FT(0), y = FT(0);
|
FT x = FT(0), y = FT(0); FT num = 0;
|
||||||
for (const auto& pair : points) {
|
for (const auto& pair : points) {
|
||||||
const auto& point = pair.first;
|
const auto& point = pair.first;
|
||||||
x += point.x();
|
x += point.x();
|
||||||
y += point.y();
|
y += point.y();
|
||||||
|
num += 1;
|
||||||
}
|
}
|
||||||
x /= static_cast<FT>(points.size());
|
x /= num;
|
||||||
y /= static_cast<FT>(points.size());
|
y /= num;
|
||||||
const Point_2 mid(x, y);
|
const Point_2 mid(x, y);
|
||||||
|
|
||||||
std::sort(points.begin(), points.end(),
|
std::sort(points.begin(), points.end(),
|
||||||
|
|
|
||||||
|
|
@ -135,12 +135,13 @@ private:
|
||||||
void calculate_centroid(Volume_cell& volume) {
|
void calculate_centroid(Volume_cell& volume) {
|
||||||
// First find a point in the interior of the volume cell.
|
// First find a point in the interior of the volume cell.
|
||||||
FT x = 0, y = 0, z = 0;
|
FT x = 0, y = 0, z = 0;
|
||||||
FT num = volume.pvertices.size();
|
FT num = 0;
|
||||||
for (const PVertex& v : volume.pvertices) {
|
for (const PVertex& v : volume.pvertices) {
|
||||||
Point_3 p = m_data.point_3(v);
|
Point_3 p = m_data.point_3(v);
|
||||||
x += p.x();
|
x += p.x();
|
||||||
y += p.y();
|
y += p.y();
|
||||||
z += p.z();
|
z += p.z();
|
||||||
|
num += 1;
|
||||||
}
|
}
|
||||||
Point_3 inside(x / num, y / num, z / num);
|
Point_3 inside(x / num, y / num, z / num);
|
||||||
|
|
||||||
|
|
@ -293,7 +294,7 @@ private:
|
||||||
m_data.incident_faces(m_data.iedge(pedge), neighbor_faces);
|
m_data.incident_faces(m_data.iedge(pedge), neighbor_faces);
|
||||||
|
|
||||||
if (neighbor_faces.size() == 2) {
|
if (neighbor_faces.size() == 2) {
|
||||||
// If there is only one neighbor, the edge is on the corner of the bbox.
|
// If there is only one neighbor, the edge is on the edge of the bbox.
|
||||||
// Thus the only neighbor needs to be a bbox face.
|
// Thus the only neighbor needs to be a bbox face.
|
||||||
PFace neighbor = (neighbor_faces[0] == pface) ? neighbor_faces[1] : neighbor_faces[0];
|
PFace neighbor = (neighbor_faces[0] == pface) ? neighbor_faces[1] : neighbor_faces[0];
|
||||||
CGAL_assertion(neighbor.first < 6 && pface.first < 6);
|
CGAL_assertion(neighbor.first < 6 && pface.first < 6);
|
||||||
|
|
@ -358,11 +359,11 @@ private:
|
||||||
// Thus the only neighbor needs to be a bbox face.
|
// Thus the only neighbor needs to be a bbox face.
|
||||||
PFace neighbor = (neighbor_faces[0] == pface) ? neighbor_faces[1] : neighbor_faces[0];
|
PFace neighbor = (neighbor_faces[0] == pface) ? neighbor_faces[1] : neighbor_faces[0];
|
||||||
CGAL_assertion(neighbor.first < 6 && pface.first < 6);
|
CGAL_assertion(neighbor.first < 6 && pface.first < 6);
|
||||||
//CGAL_assertion(oriented_side(pface, neighbor) == seed_side);
|
CGAL_assertion(oriented_side(pface, neighbor) == seed_side);
|
||||||
|
|
||||||
Oriented_side inverse_side = oriented_side(neighbor, pface);
|
Oriented_side inverse_side = oriented_side(neighbor, pface);
|
||||||
|
|
||||||
//CGAL_assertion(inverse_side == ON_POSITIVE_SIDE);
|
CGAL_assertion(inverse_side == ON_POSITIVE_SIDE);
|
||||||
|
|
||||||
if (associate(neighbor, volume_index, inverse_side, volumes, map_volumes))
|
if (associate(neighbor, volume_index, inverse_side, volumes, map_volumes))
|
||||||
queue.push(std::make_pair(neighbor, inverse_side));
|
queue.push(std::make_pair(neighbor, inverse_side));
|
||||||
|
|
@ -523,17 +524,14 @@ private:
|
||||||
if (a.first == b.first)
|
if (a.first == b.first)
|
||||||
return CGAL::ON_ORIENTED_BOUNDARY;
|
return CGAL::ON_ORIENTED_BOUNDARY;
|
||||||
Oriented_side side = CGAL::ON_ORIENTED_BOUNDARY;
|
Oriented_side side = CGAL::ON_ORIENTED_BOUNDARY;
|
||||||
const Plane_3& p = m_data.support_plane(a.first).plane();
|
const typename Intersection_kernel::Plane_3& p = m_data.support_plane(a.first).exact_plane();
|
||||||
for (auto v : m_data.pvertices_of_pface(b)) {
|
for (auto v : m_data.pvertices_of_pface(b)) {
|
||||||
Point_3 pt = m_data.point_3(v);
|
side = p.oriented_side(m_data.point_3(m_data.ivertex(v)));
|
||||||
FT dist = (p.point() - pt) * p.orthogonal_vector();
|
if (side != CGAL::ON_ORIENTED_BOUNDARY)
|
||||||
if (CGAL::abs(dist) > max_dist) {
|
return side;
|
||||||
side = p.oriented_side(m_data.point_3(v));
|
|
||||||
max_dist = CGAL::abs(dist);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return side;
|
return CGAL::ON_ORIENTED_BOUNDARY;
|
||||||
}
|
}
|
||||||
|
|
||||||
void merge_facets_connected_components() {
|
void merge_facets_connected_components() {
|
||||||
|
|
|
||||||
|
|
@ -135,71 +135,6 @@ public:
|
||||||
if (m_parameters.verbose) {
|
if (m_parameters.verbose) {
|
||||||
std::cout << "v: " << m_data.igraph().number_of_vertices() << " f: " << m_data.igraph().number_of_faces() << std::endl;
|
std::cout << "v: " << m_data.igraph().number_of_vertices() << " f: " << m_data.igraph().number_of_faces() << std::endl;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
|
|
||||||
// What data exists here and needs to be compared? The vertex positions of the igraph are identical and the number of faces too
|
|
||||||
bool k = std::is_same_v<EPECK, Intersection_kernel>;
|
|
||||||
std::string kern = k ? "EPECK" : "GMPQ";
|
|
||||||
#if _DEBUG
|
|
||||||
std::ofstream fs("after_init_dbg" + kern + ".txt");
|
|
||||||
#else
|
|
||||||
std::ofstream fs("after_init_rel" + kern + ".txt");
|
|
||||||
#endif
|
|
||||||
fs << std::setprecision(17);
|
|
||||||
// Loop through IFaces
|
|
||||||
for (std::size_t i = 0; i < m_data.igraph().number_of_faces(); i++)
|
|
||||||
if (m_data.igraph().face(i).part_of_partition)
|
|
||||||
fs << i << ". face in partition" << std::endl;
|
|
||||||
fs << m_data.igraph().number_of_faces() << std::endl;
|
|
||||||
|
|
||||||
// Dump support plane data
|
|
||||||
for (std::size_t i = 0; i < m_data.number_of_support_planes(); i++) {
|
|
||||||
auto d = m_data.support_plane(i).data();
|
|
||||||
fs << d.centroid << std::endl;
|
|
||||||
fs << d.plane << std::endl;
|
|
||||||
fs << d.exact_plane << std::endl;
|
|
||||||
fs << "ifaces:";
|
|
||||||
for (auto f : d.ifaces)
|
|
||||||
fs << " " << static_cast<std::size_t>(f);
|
|
||||||
fs << std::endl;
|
|
||||||
fs << "initial ifaces:";
|
|
||||||
for (auto f : d.initial_ifaces)
|
|
||||||
fs << " " << static_cast<std::size_t>(f);
|
|
||||||
fs << std::endl;
|
|
||||||
fs << "initial pfaces:";
|
|
||||||
for (auto f : d.initial_pfaces)
|
|
||||||
fs << " " << static_cast<std::size_t>(f);
|
|
||||||
fs << std::endl;
|
|
||||||
fs << "unique_iedges:";
|
|
||||||
for (auto f : d.unique_iedges)
|
|
||||||
fs << " " << f;
|
|
||||||
fs << std::endl;
|
|
||||||
fs << "iedges:";
|
|
||||||
for (auto f : d.iedges)
|
|
||||||
fs << " " << f;
|
|
||||||
fs << std::endl;
|
|
||||||
fs << "original_vertices:";
|
|
||||||
for (auto f : d.original_vertices)
|
|
||||||
fs << " " << f;
|
|
||||||
fs << std::endl;
|
|
||||||
fs << "original_vectors:";
|
|
||||||
for (auto f : d.original_vectors)
|
|
||||||
fs << " " << f;
|
|
||||||
fs << std::endl;
|
|
||||||
fs << "original_directions:";
|
|
||||||
for (auto f : d.original_directions)
|
|
||||||
fs << " " << f;
|
|
||||||
fs << std::endl;
|
|
||||||
fs << "original_rays:";
|
|
||||||
for (auto f : d.original_rays)
|
|
||||||
fs << " " << f;
|
|
||||||
fs << std::endl;
|
|
||||||
fs << d.distance_tolerance << std::endl;
|
|
||||||
fs << d.angle_tolerance << std::endl;
|
|
||||||
fs << d.actual_input_polygon << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.close();*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear() {
|
void clear() {
|
||||||
|
|
|
||||||
|
|
@ -368,15 +368,17 @@ public:
|
||||||
|
|
||||||
std::vector<std::pair<std::size_t, Direction_2> > dir_vec;
|
std::vector<std::pair<std::size_t, Direction_2> > dir_vec;
|
||||||
|
|
||||||
|
FT num = 0;
|
||||||
for (const auto& pair : points) {
|
for (const auto& pair : points) {
|
||||||
const auto& point = pair.first;
|
const auto& point = pair.first;
|
||||||
directions.push_back(Vector_2(m_data->centroid, point));
|
directions.push_back(Vector_2(m_data->centroid, point));
|
||||||
const FT length = static_cast<FT>(
|
const FT length = static_cast<FT>(
|
||||||
CGAL::approximate_sqrt(CGAL::abs(directions.back() * directions.back())));
|
CGAL::approximate_sqrt(CGAL::abs(directions.back() * directions.back())));
|
||||||
sum_length += length;
|
sum_length += length;
|
||||||
|
num += 1;
|
||||||
}
|
}
|
||||||
CGAL_assertion(directions.size() == n);
|
CGAL_assertion(directions.size() == n);
|
||||||
sum_length /= static_cast<FT>(n);
|
sum_length /= num;
|
||||||
|
|
||||||
dir_vec.reserve(n);
|
dir_vec.reserve(n);
|
||||||
for (std::size_t i = 0; i < n; i++)
|
for (std::size_t i = 0; i < n; i++)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue