mirror of https://github.com/CGAL/cgal
fix warnings
This commit is contained in:
parent
c4678fae18
commit
f4cd4ff3d6
|
|
@ -308,12 +308,6 @@ void dump(const DS& data, const std::string tag = std::string()) {
|
|||
dump_intersection_edges(data, tag);
|
||||
}
|
||||
|
||||
template<typename LCC>
|
||||
void dump_lcc(const LCC& lcc, const std::string tag = std::string()) {
|
||||
std::map<CGAL::Epeck::Point_3, std::size_t> pt2idx;
|
||||
std::vector<CGAL::Epeck::Point_3> pts;
|
||||
}
|
||||
|
||||
template<typename GeomTraits>
|
||||
class Saver {
|
||||
|
||||
|
|
|
|||
|
|
@ -483,7 +483,6 @@ public:
|
|||
|
||||
// Distance from edge to endpoint of iedge
|
||||
FT dist = (s - sp.data().original_vertices[source_idx]) * dir;
|
||||
Point_3 viss = sp.to_3d(s - (dist * dir));
|
||||
|
||||
edge_time[0] = dist / speed;
|
||||
|
||||
|
|
@ -503,7 +502,6 @@ public:
|
|||
|
||||
// Distance from edge to endpoint of iedge
|
||||
dist = (t - sp.data().original_vertices[target_idx]) * dir;
|
||||
Point_3 vist = sp.to_3d(t - (dist * dir));
|
||||
|
||||
edge_time[1] = dist / speed;
|
||||
|
||||
|
|
@ -607,7 +605,7 @@ public:
|
|||
|
||||
template<typename PointRange>
|
||||
std::pair<std::size_t, bool> add_support_plane(const PointRange& polygon, const bool is_bbox, const typename Intersection_kernel::Plane_3& plane) {
|
||||
const Support_plane new_support_plane(polygon, is_bbox, plane, number_of_support_planes());
|
||||
const Support_plane new_support_plane(polygon, is_bbox, plane);
|
||||
std::size_t support_plane_idx = std::size_t(-1);
|
||||
|
||||
for (std::size_t i = 0; i < number_of_support_planes(); ++i) {
|
||||
|
|
@ -632,7 +630,7 @@ public:
|
|||
|
||||
template<typename PointRange>
|
||||
std::pair<std::size_t, bool> add_support_plane(const PointRange& polygon, const bool is_bbox) {
|
||||
const Support_plane new_support_plane(polygon, is_bbox, number_of_support_planes());
|
||||
const Support_plane new_support_plane(polygon, is_bbox);
|
||||
std::size_t support_plane_idx = std::size_t(-1);
|
||||
|
||||
for (std::size_t i = 0; i < number_of_support_planes(); ++i) {
|
||||
|
|
@ -667,14 +665,12 @@ public:
|
|||
}
|
||||
|
||||
IkPoint_3 bbox_center(bbox_center_x * 0.125, bbox_center_y * 0.125, bbox_center_z * 0.125);
|
||||
Point_3 bc = from_exact(bbox_center);
|
||||
|
||||
// Intersect current plane with all bbox iedges.
|
||||
IkPoint_3 point;
|
||||
Point_3 p1;
|
||||
const auto& sp = support_plane(sp_idx);
|
||||
const auto& plane = sp.exact_plane();
|
||||
const auto plane_inexact = from_exact(plane);
|
||||
|
||||
using IEdge_vec = std::vector<IEdge>;
|
||||
using IPair = std::pair<IVertex, IEdge_vec>;
|
||||
|
|
@ -916,7 +912,7 @@ public:
|
|||
preprocess(points);
|
||||
sort_points_by_direction(points);
|
||||
support_plane(support_plane_idx).
|
||||
add_input_polygon(points, input_indices, support_plane_idx);
|
||||
add_input_polygon(points, input_indices);
|
||||
for (const std::size_t input_index : input_indices) {
|
||||
m_input_polygon_map[input_index] = support_plane_idx;
|
||||
m_sp2input_polygon[support_plane_idx].insert(input_index);
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ public:
|
|||
m_data.reset_to_initialization();
|
||||
|
||||
for (std::size_t i = 0; i < m_data.number_of_support_planes(); ++i)
|
||||
m_data.k(i) = k;
|
||||
m_data.k(i) = static_cast<int>(k);
|
||||
|
||||
initialize_queue();
|
||||
|
||||
|
|
@ -129,7 +129,7 @@ private:
|
|||
|
||||
++iteration;
|
||||
|
||||
apply(event, iteration);
|
||||
apply(event);
|
||||
}
|
||||
return iteration;
|
||||
}
|
||||
|
|
@ -138,7 +138,7 @@ private:
|
|||
** HANDLE EVENTS **
|
||||
********************************/
|
||||
|
||||
void apply(const Face_event& event, std::size_t iteration) {
|
||||
void apply(const Face_event& event) {
|
||||
if (m_data.igraph().face(event.face).part_of_partition) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -219,12 +219,11 @@ private:
|
|||
if (face2volumes.size() < num_faces)
|
||||
face2volumes.resize(num_faces, std::pair<int, int>(-1, -1));
|
||||
|
||||
|
||||
for (std::size_t j = 0; j < volumes[i].neighbors.size(); j++) {
|
||||
auto& pair = map_volumes.at(volumes[i].pfaces[j]);
|
||||
if (pair.second == -1)
|
||||
pair.second = -(volumes[i].pfaces[j].first + 1);
|
||||
volumes[i].neighbors[j] = (pair.first == i) ? pair.second : pair.first;
|
||||
pair.second = -static_cast<int>(volumes[i].pfaces[j].first + 1);
|
||||
volumes[i].neighbors[j] = (pair.first == static_cast<int>(i)) ? pair.second : pair.first;
|
||||
face2volumes[v.faces[j]] = pair;
|
||||
}
|
||||
}
|
||||
|
|
@ -301,11 +300,11 @@ private:
|
|||
Oriented_side inverse_side = oriented_side(neighbor, pface);
|
||||
CGAL_assertion(side != COPLANAR && inverse_side != COPLANAR);
|
||||
|
||||
if (side == ON_POSITIVE_SIDE && volume_indices[0] != -1) {
|
||||
if (side == ON_POSITIVE_SIDE && volume_indices[0] != static_cast<std::size_t>(-1)) {
|
||||
if (associate(neighbor, volume_indices[0], inverse_side, volumes, map_volumes))
|
||||
queue[0].push(std::make_pair(neighbor, inverse_side));
|
||||
}
|
||||
else if (side == ON_NEGATIVE_SIDE && volume_indices[1] != -1)
|
||||
else if (side == ON_NEGATIVE_SIDE && volume_indices[1] != static_cast<std::size_t>(-1))
|
||||
if (associate(neighbor, volume_indices[1], inverse_side, volumes, map_volumes))
|
||||
queue[1].push(std::make_pair(neighbor, inverse_side));
|
||||
|
||||
|
|
@ -641,7 +640,6 @@ private:
|
|||
visited_halfedges[n] = true;
|
||||
|
||||
Face_index fn = mesh.face(n);
|
||||
typename boost::graph_traits<typename Support_plane::Mesh>::faces_size_type cn = fcm[fn];
|
||||
|
||||
f_other = mesh.face(mesh.opposite(n));
|
||||
if (f_other == mesh.null_face())
|
||||
|
|
@ -731,7 +729,7 @@ private:
|
|||
|
||||
IVertex ivertex = m_data.ivertex(pvertex);
|
||||
if (ivertex2vertex[ivertex] == -1) {
|
||||
ivertex2vertex[ivertex] = vertices.size();
|
||||
ivertex2vertex[ivertex] = static_cast<int>(vertices.size());
|
||||
if (!face_filled)
|
||||
face2vertices[cell.faces[f]].push_back(vertices.size());
|
||||
else
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ public:
|
|||
{ }
|
||||
|
||||
Initializer(std::vector<std::vector<Point_3> >& input_polygons, std::vector<typename Intersection_kernel::Plane_3>& input_planes, Data_structure& data, const Parameters& parameters) :
|
||||
m_input_polygons(input_polygons), m_data(data), m_parameters(parameters), m_input_planes(input_planes)
|
||||
m_input_polygons(input_polygons), m_data(data), m_input_planes(input_planes), m_parameters(parameters)
|
||||
{ }
|
||||
|
||||
void initialize(const std::array<typename Intersection_kernel::Point_3, 8>& bbox, std::vector<std::size_t>& input_polygons) {
|
||||
|
|
@ -180,7 +180,7 @@ private:
|
|||
break;
|
||||
}
|
||||
}
|
||||
CGAL_assertion(inext != -1);
|
||||
CGAL_assertion(inext != static_cast<std::size_t>(-1));
|
||||
|
||||
next = connected[inext].first;
|
||||
face.edges.push_back(next);
|
||||
|
|
@ -218,12 +218,12 @@ private:
|
|||
|
||||
void get_prev_next(std::size_t sp_idx, IEdge edge, IEdge& prev, IEdge& next) {
|
||||
CGAL_assertion(edge != Intersection_graph::null_iedge());
|
||||
CGAL_assertion(sp_idx != -1);
|
||||
CGAL_assertion(sp_idx != static_cast<std::size_t>(-1));
|
||||
|
||||
std::vector<std::pair<IEdge, Direction_2> > connected;
|
||||
m_data.get_and_sort_all_connected_iedges(sp_idx, m_data.target(edge), connected);
|
||||
//if (connected.size() <= 2) ivertex is on bbox edge
|
||||
std::size_t inext = -1, iprev = -1;
|
||||
std::size_t inext = static_cast<std::size_t>(-1), iprev = static_cast<std::size_t>(-1);
|
||||
for (std::size_t idx = 0; idx < connected.size(); idx++) {
|
||||
if (connected[idx].first == edge) {
|
||||
iprev = (idx - 1 + connected.size()) % connected.size();
|
||||
|
|
@ -232,8 +232,8 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
CGAL_assertion(inext != -1);
|
||||
CGAL_assertion(iprev != -1);
|
||||
CGAL_assertion(inext != static_cast<std::size_t>(-1));
|
||||
CGAL_assertion(iprev != static_cast<std::size_t>(-1));
|
||||
prev = connected[iprev].first;
|
||||
next = connected[inext].first;
|
||||
}
|
||||
|
|
@ -399,7 +399,7 @@ private:
|
|||
typename Intersection_kernel::Point_2 b(sp.to_2d(m_data.point_3(m_data.target(pair.second[0]))));
|
||||
typename Intersection_kernel::Line_2 exact_line(a, b);
|
||||
Line_2 l = to_inexact(exact_line);
|
||||
Point_2 origin = l.point();
|
||||
|
||||
typename Intersection_kernel::Vector_2 ldir = exact_line.to_vector();
|
||||
ldir = (typename Intersection_kernel::FT(1.0) / CGAL::approximate_sqrt(ldir * ldir)) * ldir;
|
||||
Vector_2 dir = to_inexact(ldir);
|
||||
|
|
@ -575,11 +575,10 @@ private:
|
|||
for (auto& f : sp.ifaces()) {
|
||||
Face_property& fp = m_data.igraph().face(f);
|
||||
|
||||
typename Intersection_kernel::Point_2& p = to_exact(sp.data().centroid);
|
||||
typename Intersection_kernel::Point_2 p = to_exact(sp.data().centroid);
|
||||
bool outside = false;
|
||||
|
||||
// poly, vertices and edges in IFace are oriented ccw
|
||||
std::size_t idx = 0;
|
||||
for (std::size_t i = 0; i < fp.pts.size(); i++) {
|
||||
typename Intersection_kernel::Vector_2 ts = fp.pts[(i + fp.pts.size() - 1) % fp.pts.size()] - p;
|
||||
typename Intersection_kernel::Vector_2 tt = fp.pts[i] - p;
|
||||
|
|
@ -627,8 +626,6 @@ private:
|
|||
void add_polygons(const std::vector<std::vector<typename Intersection_kernel::Point_3> >& bbox_faces, std::vector<std::size_t>& input_polygons) {
|
||||
add_bbox_faces(bbox_faces);
|
||||
|
||||
From_exact from_exact;
|
||||
|
||||
// Filter input polygons
|
||||
std::vector<bool> remove(input_polygons.size(), false);
|
||||
for (std::size_t i = 0; i < 6; i++)
|
||||
|
|
@ -745,7 +742,7 @@ private:
|
|||
|
||||
// Create the merged polygon.
|
||||
std::vector<Point_2> merged;
|
||||
create_merged_polygon(support_plane_idx, points, merged);
|
||||
create_merged_polygon(points, merged);
|
||||
|
||||
if (is_debug) {
|
||||
std::cout << "merged polygon: " << std::endl;
|
||||
|
|
@ -763,13 +760,12 @@ private:
|
|||
polygon_b = merged;
|
||||
}
|
||||
|
||||
void create_merged_polygon(const std::size_t support_plane_idx, const std::vector<Point_2>& points, std::vector<Point_2>& merged) const {
|
||||
void create_merged_polygon(const std::vector<Point_2>& points, std::vector<Point_2>& merged) const {
|
||||
merged.clear();
|
||||
|
||||
CGAL::convex_hull_2(points.begin(), points.end(), std::back_inserter(merged));
|
||||
|
||||
CGAL_assertion(merged.size() >= 3);
|
||||
//CGAL_assertion(is_polygon_inside_bbox(support_plane_idx, merged));
|
||||
}
|
||||
|
||||
void create_bbox_meshes() {
|
||||
|
|
|
|||
|
|
@ -228,11 +228,11 @@ public:
|
|||
|
||||
bool add_face(std::size_t sp_idx, const Edge_descriptor& edge, const Face_descriptor& idx) {
|
||||
auto pair = m_graph[edge].faces.insert(std::make_pair(sp_idx, std::pair<Face_descriptor, Face_descriptor>(-1, -1)));
|
||||
if (pair.first->second.first == -1) {
|
||||
if (pair.first->second.first == static_cast<std::size_t>(-1)) {
|
||||
pair.first->second.first = idx;
|
||||
return true;
|
||||
}
|
||||
else if (pair.first->second.second == -1) {
|
||||
else if (pair.first->second.second == static_cast<std::size_t>(-1)) {
|
||||
pair.first->second.second = idx;
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,9 +139,8 @@ public:
|
|||
Support_plane() : m_data(std::make_shared<Data>()) {}
|
||||
|
||||
template<typename PointRange>
|
||||
Support_plane(const PointRange& polygon, const bool is_bbox, typename Intersection_kernel::Plane_3 plane, std::size_t idx) :
|
||||
Support_plane(const PointRange& polygon, const bool is_bbox, typename Intersection_kernel::Plane_3 plane) :
|
||||
m_data(std::make_shared<Data>()) {
|
||||
To_exact to_EK;
|
||||
|
||||
std::vector<Point_3> points;
|
||||
points.reserve(polygon.size());
|
||||
|
|
@ -154,20 +153,6 @@ public:
|
|||
const std::size_t n = points.size();
|
||||
CGAL_assertion(n == polygon.size());
|
||||
|
||||
/*
|
||||
Vector_3 normal = CGAL::NULL_VECTOR;
|
||||
for (std::size_t i = 0; i < n; ++i) {
|
||||
const std::size_t ip = (i + 1) % n;
|
||||
const auto& pa = points[i];
|
||||
const auto& pb = points[ip];
|
||||
const FT x = normal.x() + (pa.y() - pb.y()) * (pa.z() + pb.z());
|
||||
const FT y = normal.y() + (pa.z() - pb.z()) * (pa.x() + pb.x());
|
||||
const FT z = normal.z() + (pa.x() - pb.x()) * (pa.y() + pb.y());
|
||||
normal = Vector_3(x, y, z);
|
||||
}
|
||||
CGAL_assertion_msg(normal != CGAL::NULL_VECTOR, "ERROR: BBOX IS FLAT!");
|
||||
CGAL_assertion(n != 0);*/
|
||||
|
||||
From_exact from_exact;
|
||||
|
||||
m_data->k = 0;
|
||||
|
|
@ -189,7 +174,7 @@ public:
|
|||
}
|
||||
|
||||
template<typename PointRange>
|
||||
Support_plane(const PointRange& polygon, const bool is_bbox, std::size_t idx) :
|
||||
Support_plane(const PointRange& polygon, const bool is_bbox) :
|
||||
m_data(std::make_shared<Data>()) {
|
||||
To_exact to_exact;
|
||||
|
||||
|
|
@ -235,7 +220,7 @@ public:
|
|||
add_property_maps();
|
||||
}
|
||||
|
||||
Support_plane(const std::vector<typename Intersection_kernel::Point_3>& polygon, const bool is_bbox, std::size_t idx) :
|
||||
Support_plane(const std::vector<typename Intersection_kernel::Point_3>& polygon, const bool is_bbox) :
|
||||
m_data(std::make_shared<Data>()) {
|
||||
From_exact from_exact;
|
||||
|
||||
|
|
@ -399,7 +384,7 @@ public:
|
|||
template<typename Pair>
|
||||
std::size_t add_input_polygon(
|
||||
const std::vector<Pair>& points,
|
||||
const std::vector<std::size_t>& input_indices, std::size_t idx) {
|
||||
const std::vector<std::size_t>& input_indices) {
|
||||
|
||||
CGAL_assertion(is_simple_polygon(points));
|
||||
CGAL_assertion(is_convex_polygon(points));
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ private:
|
|||
using FT = typename Kernel::FT;
|
||||
using Point_2 = typename Kernel::Point_2;
|
||||
using Vector_2 = typename Kernel::Vector_2;
|
||||
using Vector_3 = typename Kernel::Vector_3;
|
||||
using Plane_3 = typename Kernel::Plane_3;
|
||||
using Line_3 = typename Kernel::Line_3;
|
||||
using Line_2 = typename Kernel::Line_2;
|
||||
|
|
@ -147,7 +148,7 @@ private:
|
|||
struct VI
|
||||
{
|
||||
VI()
|
||||
: input(false), idA2(-1, -1), idB2(-1, -1)
|
||||
: idA2(-1, -1), idB2(-1, -1), input(false)
|
||||
{}
|
||||
|
||||
void set_point(const typename Intersection_kernel::Point_3& p) {
|
||||
|
|
@ -186,8 +187,8 @@ private:
|
|||
}
|
||||
|
||||
int volA, volB;
|
||||
Index id2, idA2, idB2;
|
||||
int id, idA, idB;
|
||||
Index id2, idA2, idB2;
|
||||
};
|
||||
|
||||
typedef CGAL::Triangulation_vertex_base_with_info_2<VI, Intersection_kernel> Vbi;
|
||||
|
|
@ -393,8 +394,13 @@ public:
|
|||
const PointRange& points,
|
||||
const PolygonRange& polygons,
|
||||
const NamedParameters& np = CGAL::parameters::default_values()) {
|
||||
|
||||
using NP_helper = Point_set_processing_3_np_helper<PointRange, NamedParameters>;
|
||||
using PointMap = typename NP_helper::Point_map;
|
||||
|
||||
PointMap point_map = NP_helper::get_point_map(np);
|
||||
|
||||
To_exact to_exact;
|
||||
From_exact from_exact;
|
||||
std::size_t offset = m_input2regularized.size();
|
||||
|
||||
for (std::size_t p = 0; p < polygons.size();p++) {
|
||||
|
|
@ -403,7 +409,7 @@ public:
|
|||
std::vector<Point_3> pts;
|
||||
pts.reserve(poly.size());
|
||||
for (auto it : poly)
|
||||
pts.push_back(*(points.begin() + it));
|
||||
pts.push_back(get(point_map, *(points.begin() + it)));
|
||||
Plane_3 pl;
|
||||
Point_2 c;
|
||||
std::vector<Point_2> ch;
|
||||
|
|
@ -853,9 +859,9 @@ public:
|
|||
|
||||
auto pair = neighbors(faces_of_volume[j]);
|
||||
|
||||
if (pair.first != v && !added_volumes[pair.first])
|
||||
if (pair.first != static_cast<int>(v) && !added_volumes[pair.first])
|
||||
queue.push_back(pair.first);
|
||||
if (pair.second != v && pair.second >= 0 && !added_volumes[pair.second])
|
||||
if (pair.second != static_cast<int>(v) && pair.second >= 0 && !added_volumes[pair.second])
|
||||
queue.push_back(pair.second);
|
||||
|
||||
//auto vertex_range = m_data.pvertices_of_pface(vol.pfaces[i]);
|
||||
|
|
@ -879,7 +885,6 @@ public:
|
|||
if (len != 0)
|
||||
len = 1.0 / len;
|
||||
norm = norm * to_exact(len);
|
||||
typename Kernel::Vector_3 n1 = to_inexact(norm);
|
||||
|
||||
bool outwards_oriented = (vtx[mapped_vertices[vtx_of_face[0]]] - centroid) * norm < 0;
|
||||
//outward[std::make_pair(v, j)] = outwards_oriented;
|
||||
|
|
@ -917,7 +922,7 @@ public:
|
|||
auto o2 = outward[std::make_pair(v, j)];
|
||||
}*/
|
||||
|
||||
for (const auto& v : vtx_of_face) {
|
||||
for (const Index& v : vtx_of_face) {
|
||||
ib.add_vertex_to_facet(static_cast<std::size_t>(mapped_vertices[v]));
|
||||
//std::cout << " " << mapped_vertices[v];
|
||||
if (!used_vertices[mapped_vertices[v]]) {
|
||||
|
|
@ -928,8 +933,8 @@ public:
|
|||
|
||||
//std::cout << ")";
|
||||
auto face_dart = ib.end_facet(); // returns a dart to the face
|
||||
if (lcc.attribute<2>(face_dart) == lcc.null_descriptor) {
|
||||
lcc.set_attribute<2>(face_dart, lcc.template create_attribute<2>());
|
||||
if (lcc.template attribute<2>(face_dart) == lcc.null_descriptor) {
|
||||
lcc.template set_attribute<2>(face_dart, lcc.template create_attribute<2>());
|
||||
// How to handle bbox planes that coincide with input polygons? Check support plane
|
||||
std::size_t sp = m_partition_nodes[faces_of_volume[j].first].m_data->face_to_support_plane()[faces_of_volume[j].second];
|
||||
|
||||
|
|
@ -937,22 +942,22 @@ public:
|
|||
// 1. face belongs to a plane from an input polygon
|
||||
// 2. face originates from octree splitting (and does not have an input plane)
|
||||
// 3. face lies on the bbox
|
||||
int ip = m_partition_nodes[faces_of_volume[j].first].m_data->support_plane(sp).data().actual_input_polygon;
|
||||
int ip = static_cast<int>(m_partition_nodes[faces_of_volume[j].first].m_data->support_plane(sp).data().actual_input_polygon);
|
||||
if (ip != -1)
|
||||
lcc.info<2>(face_dart).input_polygon_index = static_cast<Face_support>(m_partition_nodes[faces_of_volume[j].first].input_polygons[ip]);
|
||||
lcc.template info<2>(face_dart).input_polygon_index = static_cast<Face_support>(m_partition_nodes[faces_of_volume[j].first].input_polygons[ip]);
|
||||
else {
|
||||
// If there is no input polygon, I need to check whether it has two neighbors
|
||||
auto n = neighbors(faces_of_volume[j]);
|
||||
if (n.second >= 0)
|
||||
lcc.info<2>(face_dart).input_polygon_index = static_cast<Face_support>(-7);
|
||||
lcc.template info<2>(face_dart).input_polygon_index = static_cast<Face_support>(-7);
|
||||
else
|
||||
lcc.info<2>(face_dart).input_polygon_index = static_cast<Face_support>(n.second);
|
||||
lcc.template info<2>(face_dart).input_polygon_index = static_cast<Face_support>(n.second);
|
||||
}
|
||||
lcc.info<2>(face_dart).part_of_initial_polygon = m_partition_nodes[faces_of_volume[j].first].m_data->face_is_part_of_input_polygon()[faces_of_volume[j].second];
|
||||
lcc.info<2>(face_dart).plane = m_partition_nodes[faces_of_volume[j].first].m_data->support_plane(m_partition_nodes[faces_of_volume[j].first].m_data->face_to_support_plane()[faces_of_volume[j].second]).exact_plane();
|
||||
lcc.template info<2>(face_dart).part_of_initial_polygon = m_partition_nodes[faces_of_volume[j].first].m_data->face_is_part_of_input_polygon()[faces_of_volume[j].second];
|
||||
lcc.template info<2>(face_dart).plane = m_partition_nodes[faces_of_volume[j].first].m_data->support_plane(m_partition_nodes[faces_of_volume[j].first].m_data->face_to_support_plane()[faces_of_volume[j].second]).exact_plane();
|
||||
}
|
||||
else {
|
||||
assert(lcc.info<2>(face_dart).part_of_initial_polygon == m_partition_nodes[faces_of_volume[j].first].m_data->face_is_part_of_input_polygon()[faces_of_volume[j].second]);
|
||||
assert(lcc.template info<2>(face_dart).part_of_initial_polygon == m_partition_nodes[faces_of_volume[j].first].m_data->face_is_part_of_input_polygon()[faces_of_volume[j].second]);
|
||||
}
|
||||
|
||||
vtx_of_face.clear();
|
||||
|
|
@ -961,11 +966,9 @@ public:
|
|||
d = ib.end_surface();
|
||||
|
||||
auto ah = lcc.template create_attribute<3>();
|
||||
lcc.set_attribute<3>(d, ah);
|
||||
lcc.info<3>(d).barycenter = centroid;
|
||||
lcc.info<3>(d).volume_id = v;
|
||||
|
||||
std::size_t unused = 0;
|
||||
lcc.template set_attribute<3>(d, ah);
|
||||
lcc.template info<3>(d).barycenter = centroid;
|
||||
lcc.template info<3>(d).volume_id = v;
|
||||
|
||||
faces_of_volume.clear();
|
||||
}
|
||||
|
|
@ -1221,7 +1224,6 @@ private:
|
|||
double build_cdt(CDTplus& cdt, std::vector<Index>& faces, std::vector<std::vector<Constraint_info> >& constraints, const typename Intersection_kernel::Plane_3& plane) {
|
||||
double area = 0;
|
||||
From_exact from_exact;
|
||||
To_exact to_exact;
|
||||
|
||||
cdt.clear();
|
||||
//keep track of constraints when inserting to iterate later
|
||||
|
|
@ -1234,8 +1236,6 @@ private:
|
|||
exact_vertices(faces[i], std::back_inserter(pts[i]), std::back_inserter(pts_idx[i]));
|
||||
constraints[i].resize(pts[i].size());
|
||||
|
||||
std::size_t j = 0;
|
||||
|
||||
CGAL::Orientation res = CGAL::COLLINEAR;
|
||||
bool pos = false;
|
||||
bool neg = false;
|
||||
|
|
@ -1244,10 +1244,6 @@ private:
|
|||
std::size_t k = (j + 1) % pts[i].size();
|
||||
std::size_t l = (k + 1) % pts[i].size();
|
||||
|
||||
Point_2 pj = from_exact(plane.to_2d(pts[i][j]));
|
||||
Point_2 pk = from_exact(plane.to_2d(pts[i][k]));
|
||||
Point_2 pl = from_exact(plane.to_2d(pts[i][l]));
|
||||
|
||||
res = orientation(plane.to_2d(pts[i][j]), plane.to_2d(pts[i][k]), plane.to_2d(pts[i][l]));
|
||||
if (res == CGAL::LEFT_TURN)
|
||||
pos = true;
|
||||
|
|
@ -1278,13 +1274,13 @@ private:
|
|||
for (std::size_t v = 0; v < pts_idx[f].size(); v++) {
|
||||
vertices.push_back(cdt.insert(plane.to_2d(pts[f][v])));
|
||||
|
||||
if (vertices.back()->info().idA2.first != -1 && vertices.back()->info().idA2 != pts_idx[f][v]) {
|
||||
if (vertices.back()->info().idA2.first != static_cast<std::size_t>(-1) && vertices.back()->info().idA2 != pts_idx[f][v]) {
|
||||
std::cout << "build_cdt faces has non-unique vertices" << std::endl;
|
||||
}
|
||||
|
||||
vertices.back()->info().idA2 = pts_idx[f][v];
|
||||
assert(pts_idx[f][v].first != -1);
|
||||
assert(pts_idx[f][v].second != -1);
|
||||
assert(pts_idx[f][v].first != static_cast<std::size_t>(-1));
|
||||
assert(pts_idx[f][v].second != static_cast<std::size_t>(-1));
|
||||
vertices.back()->info().adjacent.insert(faces[f]);
|
||||
vertices.back()->info().set_point(pts[f][v]);
|
||||
face2vtx[pts_idx[f][v]] = vertices.size() - 1;
|
||||
|
|
@ -1298,8 +1294,8 @@ private:
|
|||
for (std::size_t i = 0; i < pts_idx.size(); ++i) {
|
||||
auto& v = pts_idx[i];
|
||||
for (std::size_t j = 0; j < v.size(); ++j) {
|
||||
int vj = face2vtx[v[j]];
|
||||
int vjj = face2vtx[v[(j + 1) % v.size()]];
|
||||
int vj = static_cast<int>(face2vtx[v[j]]);
|
||||
int vjj = static_cast<int>(face2vtx[v[(j + 1) % v.size()]]);
|
||||
std::pair<Edges::iterator, bool> res = edges.insert(make_canonical_pair(vj, vjj));
|
||||
|
||||
if (res.second) {
|
||||
|
|
@ -1320,7 +1316,6 @@ private:
|
|||
std::set<Index>& a(fit->vertex(0)->info().adjacent), & b(fit->vertex(1)->info().adjacent), & c(fit->vertex(2)->info().adjacent);
|
||||
|
||||
std::set<Index> res, res2;
|
||||
Index common(std::size_t(-1), std::size_t(-1));
|
||||
std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::inserter(res, res.begin()));
|
||||
std::set_intersection(res.begin(), res.end(), c.begin(), c.end(), std::inserter(res2, res2.begin()));
|
||||
|
||||
|
|
@ -1438,8 +1433,6 @@ private:
|
|||
if (partitions.size() == 0)
|
||||
return;
|
||||
|
||||
From_exact from_exact;
|
||||
|
||||
for (std::size_t i = 0; i < partitions.size(); i++) {
|
||||
std::vector<Vertex_handle> vertices;
|
||||
vertices.reserve(6);
|
||||
|
|
@ -1627,8 +1620,6 @@ private:
|
|||
if (m_octree->is_leaf(node)) {
|
||||
// Mapping to partition is needed.
|
||||
std::size_t idx = m_node2partition[node];
|
||||
Sub_partition& partition = m_partition_nodes[m_node2partition[node]];
|
||||
From_exact from_exact;
|
||||
|
||||
if (lower)
|
||||
switch (dimension) {
|
||||
|
|
@ -1786,7 +1777,7 @@ private:
|
|||
for (std::size_t i = 0; i < faces_of_volume.size(); i++) {
|
||||
std::vector<Index> vtx;
|
||||
auto n = neighbors(faces_of_volume[i]);
|
||||
int other = (n.first == volume) ? n.second : n.first;
|
||||
int other = (n.first == static_cast<int>(volume)) ? n.second : n.first;
|
||||
if (other < 0 || !added_volumes[other])
|
||||
continue;
|
||||
vertex_indices(faces_of_volume[i], std::back_inserter(vtx));
|
||||
|
|
@ -1797,7 +1788,7 @@ private:
|
|||
|
||||
for (std::size_t i = 0; i < faces_of_volume.size(); i++) {
|
||||
auto n = neighbors(faces_of_volume[i]);
|
||||
int other = (n.first == volume) ? n.second : n.first;
|
||||
int other = (n.first == static_cast<int>(volume)) ? n.second : n.first;
|
||||
if (other >= 0 && added_volumes[other])
|
||||
continue;
|
||||
std::vector<Index> vtx;
|
||||
|
|
@ -1843,7 +1834,6 @@ private:
|
|||
axis1 = axis1 * (1.0 / la);
|
||||
FT lb = CGAL::sqrt(axis2.squared_length());
|
||||
axis2 = axis2 * (1.0 / lb);
|
||||
FT a = (axis1[0] * axis2[1]) - (axis1[1] * axis2[0]);
|
||||
|
||||
if (CGAL::abs(axis1.x()) < CGAL::abs(axis2.x())) {
|
||||
Vector_2 tmp = axis1;
|
||||
|
|
@ -1919,7 +1909,7 @@ private:
|
|||
}*/
|
||||
if (vi.idA2.first < vi.idB2.first)
|
||||
vertices[i] = vi.idA2;
|
||||
else if (vi.idB2.first != -1)
|
||||
else if (vi.idB2.first != static_cast<std::size_t>(-1))
|
||||
vertices[i] = vi.idB2;
|
||||
else {
|
||||
std::size_t vidx = m_partition_nodes[f.first].m_data->vertices().size();
|
||||
|
|
@ -1930,15 +1920,14 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
void adapt_faces(const CDTplus& cdt, std::vector<Index>& a, std::vector<Index>& b, typename Intersection_kernel::Plane_3& plane) {
|
||||
void adapt_faces(const CDTplus& cdt) {
|
||||
std::set<Index> replacedA, replacedB;
|
||||
From_exact from_exact;
|
||||
|
||||
std::size_t extracted = 0;
|
||||
for (typename CDTplus::Face_handle fh : cdt.finite_face_handles()) {
|
||||
// when extracting each face, I only need to insert vertices, that don't exist on either side. Otherwise, I can just reference the vertex in the other partition.
|
||||
// using cit->info().id2.first as visited flag. -1 means not visited
|
||||
if (fh->info().id2.first != -1)
|
||||
if (fh->info().id2.first != static_cast<std::size_t>(-1))
|
||||
continue;
|
||||
|
||||
// 4 different cases: no border edge, 1, 2 or 3
|
||||
|
|
@ -1953,7 +1942,7 @@ private:
|
|||
std::vector<Vertex_handle> face;
|
||||
|
||||
for (std::size_t i = 0; i < 3; i++)
|
||||
if (cdt.is_infinite(fh->neighbor(i)) || !same_face(fh, fh->neighbor(i))) {
|
||||
if (cdt.is_infinite(fh->neighbor(static_cast<int>(i))) || !same_face(fh, fh->neighbor(static_cast<int>(i)))) {
|
||||
face.push_back(fh->vertex((i + 2) % 3));
|
||||
face.push_back(fh->vertex((i + 1) % 3));
|
||||
break;
|
||||
|
|
@ -1972,18 +1961,7 @@ private:
|
|||
// edge is pair<Face_handle, int (vertex)>
|
||||
while (face.front() != face.back()) {
|
||||
auto eit = cdt.incident_edges(face.back(), last);
|
||||
// Skip the first edge as it always starts with the edge itself.
|
||||
//eit++;
|
||||
/*
|
||||
auto eit2 = eit;
|
||||
for (std::size_t i = 0; i < 10; i++) {
|
||||
dump_point(eit2->first->vertex(eit2->second), std::to_string(i) + "p.xyz");
|
||||
dump_face(eit2->first, std::to_string(i) + "tri.polylines.txt");
|
||||
std::cout << i << " same: " << same_face(last, eit2->first->neighbor((eit2->second + 1) % 3)) << std::endl;
|
||||
eit2++;
|
||||
}*/
|
||||
auto first = eit;
|
||||
Point_3 p = from_exact(eit->first->vertex(eit->second)->info().point_3);
|
||||
|
||||
assert(!cdt.is_infinite(eit->first));
|
||||
do {
|
||||
|
|
@ -2000,9 +1978,6 @@ private:
|
|||
|
||||
bool infinite = cdt.is_infinite(eit->first);
|
||||
|
||||
/* if (!infinite)
|
||||
dump_face(eit->first, "neighbor.polylines.txt");*/
|
||||
|
||||
if (infinite || !same_face(last, eit->first)) {
|
||||
last = eit->first->neighbor((eit->second + 1) % 3);
|
||||
last->info().id2.first = extracted;
|
||||
|
|
@ -2037,16 +2012,16 @@ private:
|
|||
}
|
||||
|
||||
std::pair<std::size_t, int> find_portal(std::size_t volume, std::size_t former, const Index& vA, const Index& vB, std::size_t& portal) const {
|
||||
portal = -7;
|
||||
portal = static_cast<std::size_t>(-7);
|
||||
auto vol = m_volumes[volume];
|
||||
std::vector<std::size_t>& faces = m_partition_nodes[vol.first].m_data->volumes()[vol.second].faces;
|
||||
|
||||
for (std::size_t f = 0; f < faces.size(); f++) {
|
||||
auto n = neighbors(std::make_pair(vol.first, faces[f]));
|
||||
if (n.first == former || n.second == former)
|
||||
if (n.first == static_cast<int>(former) || n.second == static_cast<int>(former))
|
||||
continue;
|
||||
|
||||
std::size_t idxA = -1;
|
||||
std::size_t idxA = static_cast<std::size_t>(-1);
|
||||
std::size_t numVtx = m_partition_nodes[vol.first].face2vertices[faces[f]].size();
|
||||
for (std::size_t v = 0; v < numVtx; v++)
|
||||
if (m_partition_nodes[vol.first].face2vertices[faces[f]][v] == vA) {
|
||||
|
|
@ -2054,10 +2029,10 @@ private:
|
|||
break;
|
||||
}
|
||||
// If vertex wasn't found, skip to next face.
|
||||
if (idxA == -1)
|
||||
if (idxA == static_cast<std::size_t>(-1))
|
||||
continue;
|
||||
|
||||
std::size_t idxB = -1;
|
||||
std::size_t idxB = static_cast<std::size_t>(-1);
|
||||
int dir = 0;
|
||||
if (m_partition_nodes[vol.first].face2vertices[faces[f]][(idxA + 1) % numVtx] == vB) {
|
||||
dir = 1;
|
||||
|
|
@ -2069,7 +2044,7 @@ private:
|
|||
}
|
||||
|
||||
// If only the first vertex was found, it is just an adjacent face.
|
||||
if (idxB == -1)
|
||||
if (idxB == static_cast<std::size_t>(-1))
|
||||
continue;
|
||||
|
||||
// Edge found
|
||||
|
|
@ -2081,7 +2056,7 @@ private:
|
|||
return std::make_pair(-1, -1);
|
||||
}
|
||||
|
||||
void adapt_internal_edges(const CDTplus& cdtA, const CDTplus& cdtC, const std::vector<Index> &faces_node, std::vector<std::vector<Constraint_info> >& c) {
|
||||
void adapt_internal_edges(const CDTplus& cdtC, const std::vector<Index> &faces_node, std::vector<std::vector<Constraint_info> >& c) {
|
||||
assert(faces_node.size() == c.size());
|
||||
|
||||
std::size_t not_skipped = 0;
|
||||
|
|
@ -2099,14 +2074,14 @@ private:
|
|||
id = (c[f][e].id_merged != 0) ? c[f][e].id_merged : id;
|
||||
id = (c[f][e].id_overlay != 0) ? c[f][e].id_overlay : id;
|
||||
|
||||
int volume = c[f][e].volume;
|
||||
int volume = static_cast<int>(c[f][e].volume);
|
||||
|
||||
//auto it = (c[f][e].vA < c[f][e].vB) ? constraint2edge.find(std::make_pair(c[f][e].vA, c[f][e].vB)) : constraint2edge.find(std::make_pair(c[f][e].vB, c[f][e].vA));
|
||||
|
||||
// Extract edge
|
||||
std::vector<Index> vertices_of_edge;
|
||||
for (typename CDTplus::Vertices_in_constraint_iterator vi = cdtC.vertices_in_constraint_begin(id); vi != cdtC.vertices_in_constraint_end(id); vi++) {
|
||||
if ((*vi)->info().idA2.first == -1)
|
||||
if ((*vi)->info().idA2.first == static_cast<std::size_t>(-1))
|
||||
vertices_of_edge.push_back((*vi)->info().idB2);
|
||||
else vertices_of_edge.push_back((*vi)->info().idA2);
|
||||
}
|
||||
|
|
@ -2126,11 +2101,10 @@ private:
|
|||
|
||||
int starting_volume = volume;
|
||||
|
||||
Index portal = Index(-1, -1);
|
||||
std::size_t idx, idx2;
|
||||
auto p = find_portal(volume, -7, c[f][e].vA, c[f][e].vB, idx);
|
||||
|
||||
if (idx == -7) {
|
||||
if (idx == static_cast<std::size_t>(-7)) {
|
||||
continue;
|
||||
}
|
||||
auto n = neighbors(faces_of_volume[idx]);
|
||||
|
|
@ -2139,11 +2113,11 @@ private:
|
|||
|
||||
// For cdtA, there should be two portals and for cdtB only one
|
||||
// How to discard the traversing one?
|
||||
if (idx != -7) {
|
||||
if (idx != static_cast<std::size_t>(-7)) {
|
||||
// Check if the portal idx is traversing.
|
||||
// The neighbors of a portal can be negative if it is not in the current face between the octree nodes.
|
||||
|
||||
if (idx2 < -7 && m_volumes[volume].first != m_volumes[other].first) {
|
||||
if (idx2 < static_cast<std::size_t>(-7) && m_volumes[volume].first != m_volumes[other].first) {
|
||||
idx = idx2;
|
||||
p = p2;
|
||||
}
|
||||
|
|
@ -2152,11 +2126,9 @@ private:
|
|||
idx = idx2;
|
||||
p = p2;
|
||||
}
|
||||
if (idx == -7)
|
||||
if (idx == static_cast<std::size_t>(-7))
|
||||
continue;
|
||||
|
||||
std::size_t numVtx = m_partition_nodes[faces_of_volume[idx].first].face2vertices[faces_of_volume[idx].second].size();
|
||||
|
||||
std::vector<Index> tmp = m_partition_nodes[faces_of_volume[idx].first].face2vertices[faces_of_volume[idx].second];
|
||||
|
||||
// Insert vertices in between
|
||||
|
|
@ -2173,16 +2145,15 @@ private:
|
|||
if (n.first != volume && n.second != volume)
|
||||
std::cout << "portal does not belong to volume" << std::endl;
|
||||
volume = (n.first == volume) ? n.second : n.first;
|
||||
int former = (idx == idx2) ? -1 : idx2;
|
||||
int former = (idx == idx2) ? -1 : static_cast<int>(idx2);
|
||||
|
||||
while (volume >= 0 && volume != starting_volume) { // What are the stopping conditions? There are probably several ones, e.g., arriving at the starting volume, not finding a portal face
|
||||
int next;
|
||||
faces_of_volume.clear();
|
||||
faces(volume, std::back_inserter(faces_of_volume));
|
||||
|
||||
auto p = find_portal(volume, former, c[f][e].vA, c[f][e].vB, idx);
|
||||
|
||||
if (idx == -7)
|
||||
if (idx == static_cast<std::size_t>(-7))
|
||||
break;
|
||||
|
||||
// Insert vertices in between
|
||||
|
|
@ -2217,10 +2188,6 @@ private:
|
|||
// At first, one CDTplus is created for each partition node
|
||||
std::vector<CDTplus> a_cdts(a_sets.size()), b_cdts(b_sets.size());
|
||||
|
||||
std::size_t newpts = 0;
|
||||
From_exact from_exact;
|
||||
Plane_3 pl = from_exact(plane);
|
||||
|
||||
std::vector< std::vector<std::vector<Constraint_info> > > a_constraints;
|
||||
std::vector< std::vector<std::vector<Constraint_info> > > b_constraints;
|
||||
|
||||
|
|
@ -2253,17 +2220,17 @@ private:
|
|||
|
||||
overlay(cdtC, cdtA, a_constraints, cdtB, b_constraints, plane);
|
||||
|
||||
adapt_faces(cdtC, a, b, plane);
|
||||
adapt_faces(cdtC);
|
||||
|
||||
idx = 0;
|
||||
for (auto& p : a_sets) {
|
||||
adapt_internal_edges(a_cdts[idx], cdtC, p.second, a_constraints[idx]);
|
||||
adapt_internal_edges(cdtC, p.second, a_constraints[idx]);
|
||||
idx++;
|
||||
}
|
||||
|
||||
idx = 0;
|
||||
for (auto& p : b_sets) {
|
||||
adapt_internal_edges(b_cdts[idx], cdtC, p.second, b_constraints[idx]);
|
||||
adapt_internal_edges(cdtC, p.second, b_constraints[idx]);
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue