Skip to content

Commit 78cfeac

Browse files
committed
Merge pull request #8186 from lrineau/Triangulation_3-CDT_3-lrineau
New package: CGAL 3D conforming constrained Delaunay triangulations
2 parents 6df7373 + e131dfc commit 78cfeac

235 files changed

Lines changed: 97874 additions & 2219 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,3 +1148,27 @@ Polygonal_surface_reconstruction/examples/build*
11481148
Polygonal_surface_reconstruction/test/build*
11491149
Solver_interface/examples/build*
11501150
/Mesh_3/examples/Mesh_3/indicator_0.inr.gz
1151+
/*.off
1152+
/*.xyz
1153+
/r0*
1154+
all_segments.polylines.txt
1155+
Data/data/meshes/*.*.edge
1156+
Data/data/meshes/*.*.ele
1157+
Data/data/meshes/*.*.face
1158+
Data/data/meshes/*.*.mesh
1159+
Data/data/meshes/*.*.node
1160+
Data/data/meshes/*.*.smesh
1161+
Data/data/meshes/*.*.vtk
1162+
Data/data/meshes/*.log
1163+
Data/data/meshes/*.off-cdt-output.off
1164+
dump_*.off
1165+
dump_*.txt
1166+
dump-*.binary.cgal
1167+
dump-*.polylines.txt
1168+
dump-*.xyz
1169+
dump.off.mesh
1170+
log.txt
1171+
patches_after_merge.ply
1172+
CMakeUserPresets.json
1173+
/.cache
1174+
compile_commands.json

AABB_tree/include/CGAL/AABB_traits_3.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,12 +302,11 @@ class AABB_traits_3
302302
typename AT::Bounding_box operator()(ConstPrimitiveIterator first,
303303
ConstPrimitiveIterator beyond) const
304304
{
305-
typename AT::Bounding_box bbox = m_traits.compute_bbox(*first,m_traits.bbm);
306-
for(++first; first != beyond; ++first)
307-
{
308-
bbox = bbox + m_traits.compute_bbox(*first,m_traits.bbm);
309-
}
310-
return bbox;
305+
return std::accumulate(first, beyond,
306+
typename AT::Bounding_box{} /* empty bbox */,
307+
[this](const typename AT::Bounding_box& bbox, const Primitive& pr) {
308+
return bbox + m_traits.compute_bbox(pr, m_traits.bbm);
309+
});
311310
}
312311

313312
};

AABB_tree/include/CGAL/AABB_tree.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,7 @@ namespace CGAL {
199199
}
200200

201201
/// returns the axis-aligned bounding box of the whole tree.
202-
/// \pre `!empty()`
203202
const Bounding_box bbox() const {
204-
CGAL_precondition(!empty());
205203
if(size() > 1)
206204
return root_node()->bbox();
207205
else

Arrangement_on_surface_2/demo/Arrangement_on_surface_2_earth/Kml_reader.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ Kml::Nodes Kml::generate_ids_approx(Placemarks& placemarks, const double eps) {
269269

270270
for (const auto& node : lring->nodes) {
271271
// check if there is a node sufficiently close to the current one
272-
auto node_index = std::numeric_limits<std::size_t>::max();
272+
auto node_index = (std::numeric_limits<std::size_t>::max)();
273273
for (std::size_t i = 0; i < nodes.size(); ++i) {
274274
const auto dist = node.distance_to(nodes[i]);
275275
if (dist < eps) {
@@ -278,7 +278,7 @@ Kml::Nodes Kml::generate_ids_approx(Placemarks& placemarks, const double eps) {
278278
}
279279
}
280280

281-
if (node_index == std::numeric_limits<std::size_t>::max()) {
281+
if (node_index == (std::numeric_limits<std::size_t>::max)()) {
282282
// insert new node
283283
nodes.push_back(node);
284284
const auto node_id = nodes.size() - 1;
@@ -301,7 +301,7 @@ Kml::Nodes Kml::generate_ids_approx(Placemarks& placemarks, const double eps) {
301301
}
302302

303303
// find the pair of closest nodes
304-
double min_dist = std::numeric_limits<double>::max();
304+
double min_dist = (std::numeric_limits<double>::max)();
305305
std::size_t ni1 = 0;
306306
std::size_t ni2 = 0;
307307
std::size_t num_nodes = nodes.size();

BGL/doc/BGL/PackageDescription.txt

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ digraph example {
3131
}
3232
\enddot
3333

34-
\cgalHeading{Notations}
34+
\cgalHeading{Notations}
3535

3636
<dl>
3737
<dt>`G`</dt> <dd>A type that is a model of a graph concept.</dd>
@@ -51,8 +51,8 @@ and adds the requirement for traversal of all vertices in a graph.
5151
<center>
5252
<table>
5353
<tr>
54-
<th width="800">Associated Type</th>
55-
<th width="800">Description</th>
54+
<th class="associated-type">Associated Type</th>
55+
<th class="description">Description</th>
5656
</tr>
5757
<tr>
5858
<td>`boost::graph_traits<G>::%vertex_iterator`</td>
@@ -66,9 +66,9 @@ and adds the requirement for traversal of all vertices in a graph.
6666

6767
<table>
6868
<tr>
69-
<th width="392">Valid Expression</th>
70-
<th width="392">Return Type</th>
71-
<th width="800">Description</th>
69+
<th class="valid-expression">Valid Expression</th>
70+
<th class="return-type">Return Type</th>
71+
<th class="description">Description</th>
7272
</tr>
7373
<tr>
7474
<td>`vertices(g)`</td>
@@ -92,8 +92,8 @@ and adds the requirement for traversal of all edges in a graph.
9292
<center>
9393
<table>
9494
<tr>
95-
<th width="800">Associated Type</th>
96-
<th width="800">Description</th>
95+
<th class="associated-type">Associated Type</th>
96+
<th class="description">Description</th>
9797
</tr>
9898
<tr>
9999
<td>`boost::graph_traits<G>::%edge_iterator`</td>
@@ -107,9 +107,9 @@ and adds the requirement for traversal of all edges in a graph.
107107

108108
<table>
109109
<tr>
110-
<th width="392">Valid Expression</th>
111-
<th width="392">Return Type</th>
112-
<th width="800">Description</th>
110+
<th class="valid-expression">Valid Expression</th>
111+
<th class="return-type">Return Type</th>
112+
<th class="description">Description</th>
113113
</tr>
114114
<tr>
115115
<td>`edges(g)`</td>
@@ -143,8 +143,8 @@ and adds the notion of halfedges, where each edge corresponds to two opposite ha
143143
<center>
144144
<table>
145145
<tr>
146-
<th width="800">Associated Type</th>
147-
<th width="800">Description</th>
146+
<th class="associated-type">Associated Type</th>
147+
<th class="description">Description</th>
148148
</tr>
149149
<tr>
150150
<td>`boost::graph_traits<G>::%halfedge_descriptor`</td>
@@ -154,9 +154,9 @@ and adds the notion of halfedges, where each edge corresponds to two opposite ha
154154

155155
<table>
156156
<tr>
157-
<th width="392">Valid Expression</th>
158-
<th width="392">Return Type</th>
159-
<th width="800">Description</th>
157+
<th class="valid-expression">Valid Expression</th>
158+
<th class="return-type">Return Type</th>
159+
<th class="description">Description</th>
160160
</tr>
161161
<tr>
162162
<td>`edge(h, g)`</td>
@@ -222,9 +222,9 @@ update the incidence information between vertices and halfedges.
222222
<center>
223223
<table>
224224
<tr>
225-
<th width="392">Valid Expression</th>
226-
<th width="392">Return Type</th>
227-
<th width="800">Description</th>
225+
<th class="valid-expression">Valid Expression</th>
226+
<th class="return-type">Return Type</th>
227+
<th class="description">Description</th>
228228
</tr>
229229
<tr>
230230
<td>`add_vertex(g)`</td>
@@ -272,8 +272,8 @@ and adds the requirements for traversal of all halfedges in the graph.
272272
<center>
273273
<table>
274274
<tr>
275-
<th width="800">Associated Type</th>
276-
<th width="800">Description</th>
275+
<th class="associated-type">Associated Type</th>
276+
<th class="description">Description</th>
277277
</tr>
278278
<tr>
279279
<td>`boost::graph_traits<G>::%halfedge_iterator`</td>
@@ -287,9 +287,9 @@ and adds the requirements for traversal of all halfedges in the graph.
287287

288288
<table>
289289
<tr>
290-
<th width="392">Valid Expression</th>
291-
<th width="392">Return Type</th>
292-
<th width="800">Description</th>
290+
<th class="valid-expression">Valid Expression</th>
291+
<th class="return-type">Return Type</th>
292+
<th class="description">Description</th>
293293
</tr>
294294
<tr>
295295
<td>`halfedges(g)`</td>
@@ -315,8 +315,8 @@ face.
315315
<center>
316316
<table>
317317
<tr>
318-
<th width="800">Associated Type</th>
319-
<th width="800">Description</th>
318+
<th class="associated-type">Associated Type</th>
319+
<th class="description">Description</th>
320320
</tr>
321321
<tr>
322322
<td>`boost::graph_traits<G>::%face_descriptor`</td>
@@ -326,9 +326,9 @@ face.
326326

327327
<table>
328328
<tr>
329-
<th width="392">Valid Expression</th>
330-
<th width="392">Return Type</th>
331-
<th width="800">Description</th>
329+
<th class="valid-expression">Valid Expression</th>
330+
<th class="return-type">Return Type</th>
331+
<th class="description">Description</th>
332332
</tr>
333333
<tr>
334334
<td>`face(h, g)`</td>
@@ -361,9 +361,9 @@ the requirement for operations to add faces and to modify face-halfedge relation
361361
<center>
362362
<table>
363363
<tr>
364-
<th width="392">Valid Expression</th>
365-
<th width="392">Return Type</th>
366-
<th width="800">Description</th>
364+
<th class="valid-expression">Valid Expression</th>
365+
<th class="return-type">Return Type</th>
366+
<th class="description">Description</th>
367367
</tr>
368368
<tr>
369369
<td>`add_face(g)`</td>
@@ -401,8 +401,8 @@ the requirement for traversal of all faces in a graph.
401401
<center>
402402
<table>
403403
<tr>
404-
<th width="800">Associated Type</th>
405-
<th width="800">Description</th>
404+
<th class="associated-type">Associated Type</th>
405+
<th class="description">Description</th>
406406
</tr>
407407
<tr>
408408
<td>`boost::graph_traits<G>::%face_iterator`</td>
@@ -416,9 +416,9 @@ the requirement for traversal of all faces in a graph.
416416

417417
<table>
418418
<tr>
419-
<th width="392">Valid Expression</th>
420-
<th width="392">Return Type</th>
421-
<th width="800">Description</th>
419+
<th class="valid-expression">Valid Expression</th>
420+
<th class="return-type">Return Type</th>
421+
<th class="description">Description</th>
422422
</tr>
423423
<tr>
424424
<td>`faces(g)`</td>

BGL/include/CGAL/boost/graph/named_params_helper.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,32 @@ struct GetGeomTraits
227227
NamedParametersVPM>::type type;
228228
};
229229

230+
namespace internal {
231+
// Similar helper for polygon soups
232+
template <typename PointRange, typename PolygonRange>
233+
struct Polygon_types
234+
{
235+
typedef typename boost::range_value<PointRange>::type Point_3;
236+
typedef typename boost::range_value<PolygonRange>::type Polygon_3;
237+
238+
typedef typename boost::range_iterator<Polygon_3>::type V_ID_iterator;
239+
typedef typename std::iterator_traits<V_ID_iterator>::value_type V_ID;
240+
typedef typename std::vector<Polygon_3>::size_type P_ID;
241+
};
242+
}
243+
244+
template <typename PointRange, typename PolygonRange, typename NamedParameters>
245+
struct GetPolygonGeomTraits
246+
{
247+
typedef typename internal_np::Lookup_named_param_def <
248+
internal_np::geom_traits_t,
249+
NamedParameters,
250+
typename CGAL::Kernel_traits<
251+
typename internal::Polygon_types<
252+
PointRange, PolygonRange>::Point_3 >::type
253+
> ::type type;
254+
};
255+
230256
// Define the following structs:
231257
//
232258
// GetInitializedVertexIndexMap

BGL/include/CGAL/boost/graph/split_graph_into_polylines.h

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
#include <map>
1818
#include <vector>
19-
#include <utility>
2019
#include <boost/graph/adjacency_list.hpp>
2120
#include <CGAL/assertions.h>
2221
#include <CGAL/tags.h>
@@ -143,34 +142,29 @@ void duplicate_terminal_vertices(Graph& graph,
143142
{
144143
typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_descriptor;
145144
typedef typename boost::graph_traits<Graph>::edge_descriptor edge_descriptor;
146-
typedef typename boost::graph_traits<Graph>::vertex_iterator vertex_iterator;
147-
typedef typename boost::graph_traits<Graph>::out_edge_iterator out_edge_iterator;
148145

149-
vertex_iterator b,e;
150-
std::tie(b,e) = vertices(graph);
151-
std::vector<vertex_descriptor> V(b,e);
146+
auto [b, e] = vertices(graph);
147+
std::vector<vertex_descriptor> V(b, e); // copy vertices, because the graph may change
148+
std::vector<edge_descriptor> out_edges_of_v; // used to store the out edges of a vertex
149+
// created here to avoid allocating it in the loop
152150
for(vertex_descriptor v : V)
153151
{
154-
typename boost::graph_traits<OrigGraph>::vertex_descriptor orig_v = graph[v];
155-
typename boost::graph_traits<Graph>::degree_size_type deg = degree(v, graph);
152+
auto orig_v = graph[v];
153+
auto deg = degree(v, graph);
156154
if (deg != 2 || is_terminal(orig_v, orig))
155+
{
156+
auto [b, e] = out_edges(v, graph);
157+
out_edges_of_v.assign(b, e); // same as creating a new vector from the range [b,e)
158+
for (unsigned int i = 1; i < out_edges_of_v.size(); ++i)
157159
{
158-
out_edge_iterator b, e;
159-
std::tie(b, e) = out_edges(v, graph);
160-
std::vector<edge_descriptor> out_edges_of_v(b, e);
161-
for (unsigned int i = 1; i < out_edges_of_v.size(); ++i)
162-
{
163-
edge_descriptor e = out_edges_of_v[i];
164-
typename boost::graph_traits<OrigGraph>::edge_descriptor orig_e =
165-
graph[e];
166-
vertex_descriptor w = target(e, graph);
167-
remove_edge(e, graph);
168-
vertex_descriptor vc = add_vertex(graph);
169-
graph[vc] = orig_v;
170-
const std::pair<edge_descriptor, bool> pair = add_edge(vc, w, graph);
171-
graph[pair.first] = orig_e;
172-
}
160+
edge_descriptor e = out_edges_of_v[i];
161+
auto orig_e = graph[e];
162+
vertex_descriptor w = target(e, graph);
163+
remove_edge(e, graph);
164+
vertex_descriptor vc = add_vertex(orig_v, graph);
165+
add_edge(vc, w, orig_e, graph);
173166
}
167+
}
174168
}
175169

176170
// check all vertices are of degree 1 or 2 and that the source
@@ -271,8 +265,7 @@ split_graph_into_polylines(const Graph& graph,
271265
V2vmap v2vmap;
272266

273267
for(Graph_vertex_descriptor v : make_range(vertices(graph))){
274-
vertex_descriptor vc = add_vertex(g_copy);
275-
g_copy[vc] = v;
268+
vertex_descriptor vc = add_vertex(v, g_copy);
276269
v2vmap[v] = vc;
277270
}
278271

@@ -281,9 +274,7 @@ split_graph_into_polylines(const Graph& graph,
281274
Graph_vertex_descriptor vt = target(e,graph);
282275
CGAL_warning_msg(vs != vt, "ignore self loops");
283276
if(vs != vt){
284-
const std::pair<edge_descriptor, bool> pair =
285-
add_edge(v2vmap[vs],v2vmap[vt],g_copy);
286-
g_copy[pair.first] = e;
277+
add_edge(v2vmap[vs], v2vmap[vt], e, g_copy);
287278
}
288279
}
289280
}

BGL/test/BGL/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ else()
6363
message(STATUS "NOTICE: Tests that use OpenMesh will not be compiled.")
6464
endif()
6565

66+
set(CMAKE_POLICY_DEFAULT_CMP0167 NEW)
6667
find_package(VTK 9.0 QUIET COMPONENTS CommonCore IOCore IOLegacy IOXML FiltersCore FiltersSources)
6768
if (VTK_FOUND AND VTK_LIBRARIES)
6869
message(STATUS "VTK ${VTK_VERSION} found ${VTK_LIBRARIES}")

Circular_kernel_3/doc/Circular_kernel_3/Concepts/AlgebraicKernelForSpheres--PolynomialForSpheres_2_3.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ are of a type that is a model of the concept
1212
\cgalRefines{CopyConstructible,Assignable,DefaultConstructible}
1313
1414
\cgalHasModelsBegin
15-
\cgalHasModels{GAL::Polynomial_for_spheres_2_}
15+
\cgalHasModels{CGAL::Polynomial_for_spheres_2_}
1616
\cgalHasModelsEnd
1717
1818
\sa `AlgebraicKernelForSpheres`

0 commit comments

Comments
 (0)