Skip to content

Commit c7e05a5

Browse files
committed
WIP
1 parent 2b8c2ef commit c7e05a5

File tree

67 files changed

+1025
-765
lines changed

Some content is hidden

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

67 files changed

+1025
-765
lines changed

Alpha_shapes_2/include/CGAL/Alpha_shape_2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class Alpha_shape_2 : public Dt
6363
// is set to true rely on a permanent and safe access to the points.
6464
static_assert(
6565
(std::is_same<ExactAlphaComparisonTag, Tag_false>::value) ||
66-
(std::is_same<typename Dt::Periodic_tag, Tag_false>::value));
66+
(false == is_periodic_triangulation_v<Dt>));
6767

6868
typedef typename internal::Alpha_nt_selector_2<
6969
Gt, ExactAlphaComparisonTag, typename Dt::Weighted_tag>::Type_of_alpha Type_of_alpha;

Alpha_shapes_3/include/CGAL/Alpha_shape_3.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class Alpha_shape_3 : public Dt
9999
// is set to true rely on a permanent and safe access to the points.
100100
static_assert(
101101
(std::is_same<ExactAlphaComparisonTag, Tag_false>::value) ||
102-
(std::is_same<typename Dt::Periodic_tag, Tag_false>::value));
102+
(false == is_periodic_triangulation_v<Dt>));
103103

104104
//extra the type used for representing alpha according to ExactAlphaComparisonTag
105105
typedef typename internal::Alpha_nt_selector_3<Gt,ExactAlphaComparisonTag,typename Dt::Weighted_tag>::Type_of_alpha NT;

Generator/include/CGAL/point_generators_3.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#define CGAL_POINT_GENERATORS_3_H 1
2222

2323
#include <CGAL/disable_warnings.h>
24+
#include <CGAL/type_traits.h>
2425

2526
#include <CGAL/generators.h>
2627
#include <CGAL/point_generators_2.h>
@@ -486,7 +487,7 @@ template<class C3T3>
486487
class Triangle_from_c3t3_facet
487488
{
488489
typedef typename C3T3::Triangulation Tr;
489-
typedef typename Tr::Bare_point Bare_point;
490+
typedef Bare_point_type_t<Tr> Bare_point;
490491
typedef typename Tr::Triangle Triangle;
491492
typedef typename Tr::Facet Facet;
492493
typedef typename Tr::Cell_handle Cell_handle;
@@ -516,8 +517,8 @@ template<class C3T3>
516517
class Tetrahedron_from_c3t3_cell
517518
{
518519
typedef typename C3T3::Triangulation Tr;
520+
typedef Bare_point_type_t<Tr> Bare_point;
519521
typedef typename Tr::Cell_handle Cell;
520-
typedef typename Tr::Bare_point Bare_point;
521522
typedef typename Tr::Tetrahedron Tetrahedron;
522523

523524
public:

Mesh_3/examples/Mesh_3/mesh_implicit_sphere.cpp

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,45 @@
1+
#define CGAL_MESH_3_VERBOSE 1
12
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
23

3-
#include <CGAL/Mesh_triangulation_3.h>
4+
#include <CGAL/Triangulation_vertex_base_3.h>
5+
#include <CGAL/Delaunay_triangulation_cell_base_3.h>
6+
#include <CGAL/Mesh_vertex_base_3.h>
7+
#include <CGAL/Mesh_cell_base_3.h>
8+
49
#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
510
#include <CGAL/Mesh_criteria_3.h>
611

712
#include <CGAL/Labeled_mesh_domain_3.h>
813
#include <CGAL/make_mesh_3.h>
914

15+
#include <CGAL/Delaunay_triangulation_3.h>
16+
1017
// Domain
11-
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
12-
typedef K::FT FT;
13-
typedef K::Point_3 Point;
14-
typedef FT (Function)(const Point&);
15-
typedef CGAL::Labeled_mesh_domain_3<K> Mesh_domain;
18+
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
19+
using FT = K::FT;
20+
using Point = K::Point_3;
21+
using Function = FT(const Point&);
22+
using Mesh_domain = CGAL::Labeled_mesh_domain_3<K>;
1623

24+
using Concurrency_tag =
1725
#ifdef CGAL_CONCURRENT_MESH_3
18-
typedef CGAL::Parallel_tag Concurrency_tag;
26+
CGAL::Parallel_tag;
1927
#else
20-
typedef CGAL::Sequential_tag Concurrency_tag;
28+
CGAL::Sequential_tag;
2129
#endif
2230

2331
// Triangulation
24-
typedef CGAL::Mesh_triangulation_3<Mesh_domain,CGAL::Default,Concurrency_tag>::type Tr;
32+
using Dt_vb = CGAL::Triangulation_vertex_base_3<K>;
33+
using Vb = CGAL::Mesh_vertex_base_3<K, Mesh_domain, Dt_vb>;
34+
using Dt_cb = CGAL::Delaunay_triangulation_cell_base_3<K>;
35+
using Cb = CGAL::Mesh_cell_base_3<K, Mesh_domain, Dt_cb>;
36+
using Tds = CGAL::Triangulation_data_structure_3<Vb, Cb, Concurrency_tag>;
37+
using Tr = CGAL::Delaunay_triangulation_3<K, Tds>;
2538

26-
typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> C3t3;
39+
using C3t3 = CGAL::Mesh_complex_3_in_triangulation_3<Tr>;
2740

2841
// Criteria
29-
typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
42+
using Mesh_criteria = CGAL::Mesh_criteria_3<Tr>;
3043

3144
namespace params = CGAL::parameters;
3245

@@ -56,4 +69,3 @@ int main()
5669

5770
return 0;
5871
}
59-

Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <CGAL/tuple.h>
3131
#include <CGAL/iterator.h>
3232
#include <CGAL/array.h>
33+
#include <CGAL/type_traits.h>
3334
#include <CGAL/Handle_hash_function.h>
3435

3536
#ifdef CGAL_MESH_3_PROFILING
@@ -376,8 +377,7 @@ class C3T3_helpers_base
376377
{
377378
protected:
378379
typedef typename Tr::Geom_traits GT;
379-
typedef typename Tr::Bare_point Bare_point;
380-
typedef typename Tr::Weighted_point Weighted_point;
380+
typedef typename Tr::Point Weighted_point;
381381
typedef typename GT::FT FT;
382382
typedef typename Tr::Vertex_handle Vertex_handle;
383383
typedef typename Tr::Cell_handle Cell_handle;
@@ -448,8 +448,8 @@ class C3T3_helpers_base<Tr, Parallel_tag>
448448
{
449449
protected:
450450
typedef typename Tr::Geom_traits GT;
451-
typedef typename Tr::Bare_point Bare_point;
452-
typedef typename Tr::Weighted_point Weighted_point;
451+
typedef Bare_point_type_t<Tr> Bare_point;
452+
typedef typename Tr::Point Weighted_point;
453453
typedef typename Tr::Vertex_handle Vertex_handle;
454454
typedef typename Tr::Cell_handle Cell_handle;
455455
typedef typename Tr::Facet Facet;
@@ -609,7 +609,8 @@ template <typename C3T3,
609609
typename MeshDomain>
610610
class C3T3_helpers
611611
: public C3T3_helpers_base<typename C3T3::Triangulation,
612-
typename C3T3::Concurrency_tag>
612+
typename C3T3::Concurrency_tag>,
613+
public CGAL::Mesh_3::Triangulation_helpers<typename C3T3::Triangulation>
613614
{
614615
// -----------------------------------
615616
// Private types
@@ -625,8 +626,8 @@ class C3T3_helpers
625626
typedef typename Tr::Geom_traits GT;
626627

627628
typedef typename GT::FT FT;
628-
typedef typename Tr::Bare_point Bare_point;
629-
typedef typename Tr::Weighted_point Weighted_point;
629+
typedef typename Tr::Point Weighted_point;
630+
typedef Bare_point_type_t<Tr> Bare_point;
630631
typedef typename GT::Vector_3 Vector_3;
631632
typedef typename GT::Plane_3 Plane_3;
632633
typedef typename GT::Tetrahedron_3 Tetrahedron;
@@ -640,8 +641,8 @@ class C3T3_helpers
640641
typedef typename C3T3::Subdomain_index Subdomain_index;
641642
typedef typename C3T3::Index Index;
642643

643-
typedef std::optional<Surface_patch_index> Surface_patch;
644-
typedef std::optional<Subdomain_index> Subdomain;
644+
typedef std::optional<Surface_patch_index> Surface_patch;
645+
typedef std::optional<Subdomain_index> Subdomain;
645646

646647
typedef std::vector<Cell_handle> Cell_vector;
647648
typedef std::set<Cell_handle> Cell_set;
@@ -735,7 +736,7 @@ class C3T3_helpers
735736
/** @brief tries to move `old_vertex` to `new_position` in the mesh
736737
*
737738
* Same as update_mesh, but with the precondition that
738-
* Th().no_topological_change(tr_, old_vertex, new_position,
739+
* this->no_topological_change(tr_, old_vertex, new_position,
739740
* incident_cells_) return false.
740741
*/
741742
template <typename SliverCriterion, typename OutputIterator>
@@ -2149,15 +2150,13 @@ class C3T3_helpers
21492150

21502151
template <typename CellForwardIterator>
21512152
void reset_circumcenter_cache(CellForwardIterator cells_begin,
2152-
CellForwardIterator cells_end) const
2153+
CellForwardIterator cells_end) const
21532154
{
2154-
while(cells_begin != cells_end) {
2155-
(*cells_begin)->invalidate_weighted_circumcenter_cache();
2156-
++cells_begin;
2157-
}
2155+
if constexpr(is_regular_triangulation_v<Tr>)
2156+
for(auto it = cells_begin; it != cells_end; ++it)
2157+
(*it)->invalidate_weighted_circumcenter_cache();
21582158
}
21592159

2160-
21612160
private:
21622161

21632162
// Functor for update_facets function (base)
@@ -2436,7 +2435,7 @@ update_mesh(const Vertex_handle& old_vertex,
24362435
Cell_vector incident_cells_;
24372436
incident_cells_.reserve(64);
24382437
tr_.incident_cells(old_vertex, std::back_inserter(incident_cells_));
2439-
if ( Th().no_topological_change(tr_, old_vertex, move, new_position, incident_cells_) )
2438+
if ( this->no_topological_change(tr_, old_vertex, move, new_position, incident_cells_) )
24402439
{
24412440
return update_mesh_no_topo_change(old_vertex, move, new_position, criterion,
24422441
modified_vertices, incident_cells_);
@@ -2674,7 +2673,7 @@ C3T3_helpers<C3T3,MD>::
26742673
rebuild_restricted_delaunay(OutdatedCells& outdated_cells,
26752674
Moving_vertices_set& moving_vertices)
26762675
{
2677-
typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object();
2676+
auto cp = this->construct_bare_point_object(tr_);
26782677

26792678
typename OutdatedCells::iterator first_cell = outdated_cells.begin();
26802679
typename OutdatedCells::iterator last_cell = outdated_cells.end();
@@ -2804,7 +2803,7 @@ rebuild_restricted_delaunay(ForwardIterator first_cell,
28042803
ForwardIterator last_cell,
28052804
Moving_vertices_set& moving_vertices)
28062805
{
2807-
typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object();
2806+
auto cp = this->construct_bare_point_object(tr_);
28082807
typename GT::Construct_vector_3 vector = tr_.geom_traits().construct_vector_3_object();
28092808
typename GT::Equal_3 equal = tr_.geom_traits().equal_3_object();
28102809

@@ -2943,29 +2942,29 @@ move_point(const Vertex_handle& old_vertex,
29432942
#endif
29442943

29452944
typename GT::Construct_translated_point_3 translate = tr_.geom_traits().construct_translated_point_3_object();
2946-
typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object();
2947-
typename GT::Construct_weighted_point_3 cwp = tr_.geom_traits().construct_weighted_point_3_object();
2945+
auto cp = this->construct_bare_point_object(tr_);
2946+
auto cwp = this->construct_triangulation_point_object(tr_);
29482947

29492948
Cell_vector incident_cells_;
29502949
incident_cells_.reserve(64);
29512950

2952-
# ifdef CGAL_LINKED_WITH_TBB
2951+
#ifdef CGAL_LINKED_WITH_TBB
29532952
// Parallel
29542953
if (std::is_convertible<Concurrency_tag, Parallel_tag>::value)
29552954
{
29562955
tr_.incident_cells_threadsafe(old_vertex, std::back_inserter(incident_cells_));
29572956
}
29582957
// Sequential
29592958
else
2960-
# endif // CGAL_LINKED_WITH_TBB
2959+
#endif // CGAL_LINKED_WITH_TBB
29612960
{
29622961
tr_.incident_cells(old_vertex, std::back_inserter(incident_cells_));
29632962
}
29642963

29652964
const Weighted_point& position = tr_.point(old_vertex);
29662965
const Weighted_point& new_position = cwp(translate(cp(position), move));
29672966

2968-
if ( Th().no_topological_change(tr_, old_vertex, move, new_position, incident_cells_) )
2967+
if ( this->no_topological_change(tr_, old_vertex, move, new_position, incident_cells_) )
29692968
{
29702969
reset_circumcenter_cache(incident_cells_);
29712970
reset_sliver_cache(incident_cells_);
@@ -2994,8 +2993,8 @@ move_point(const Vertex_handle& old_vertex,
29942993
#endif
29952994

29962995
typename GT::Construct_translated_point_3 translate = tr_.geom_traits().construct_translated_point_3_object();
2997-
typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object();
2998-
typename GT::Construct_weighted_point_3 cwp = tr_.geom_traits().construct_weighted_point_3_object();
2996+
auto cp = this->construct_bare_point_object(tr_);
2997+
auto cwp = this->construct_triangulation_point_object(tr_);
29992998

30002999
Cell_vector incident_cells_;
30013000
incident_cells_.reserve(64);
@@ -3004,7 +3003,7 @@ move_point(const Vertex_handle& old_vertex,
30043003
const Weighted_point& position = tr_.point(old_vertex);
30053004
const Weighted_point& new_position = cwp(translate(cp(position), move));
30063005

3007-
if ( Th().no_topological_change(tr_, old_vertex, move, new_position, incident_cells_) )
3006+
if ( this->no_topological_change(tr_, old_vertex, move, new_position, incident_cells_) )
30083007
{
30093008
reset_circumcenter_cache(incident_cells_);
30103009
reset_sliver_cache(incident_cells_);
@@ -3058,8 +3057,8 @@ move_point(const Vertex_handle& old_vertex,
30583057
//======= /Get incident cells ==========
30593058

30603059
typename GT::Construct_translated_point_3 translate = tr_.geom_traits().construct_translated_point_3_object();
3061-
typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object();
3062-
typename GT::Construct_weighted_point_3 cwp = tr_.geom_traits().construct_weighted_point_3_object();
3060+
auto cp = this->construct_bare_point_object(tr_);
3061+
auto cwp = this->construct_triangulation_point_object(tr_);
30633062

30643063
const Weighted_point& position = tr_.point(old_vertex);
30653064
const Weighted_point& new_position = cwp(translate(cp(position), move));
@@ -3071,7 +3070,7 @@ move_point(const Vertex_handle& old_vertex,
30713070
return Vertex_handle();
30723071
}
30733072

3074-
if ( Th().no_topological_change(tr_, old_vertex, move, new_position, incident_cells_) )
3073+
if ( this->no_topological_change(tr_, old_vertex, move, new_position, incident_cells_) )
30753074
{
30763075
reset_circumcenter_cache(incident_cells_);
30773076
reset_sliver_cache(incident_cells_);
@@ -3349,7 +3348,7 @@ move_point_no_topo_change(const Vertex_handle& old_vertex,
33493348
const Weighted_point& new_position) const
33503349
{
33513350
// Change vertex position
3352-
tr_.set_point(old_vertex, move, new_position);
3351+
this->set_point(tr_, old_vertex, move, new_position);
33533352
CGAL_expensive_postcondition(tr_.is_valid());
33543353
return old_vertex;
33553354
}
@@ -3427,7 +3426,7 @@ get_least_square_surface_plane(const Vertex_handle& v,
34273426
{
34283427
typedef typename C3T3::Triangulation::Triangle Triangle;
34293428

3430-
typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object();
3429+
auto cp = this->construct_bare_point_object(tr_);
34313430

34323431
// Get incident facets
34333432
Facet_vector facets;
@@ -3459,7 +3458,7 @@ get_least_square_surface_plane(const Vertex_handle& v,
34593458
if(ref_facet.first == Cell_handle())
34603459
ref_facet = f;
34613460

3462-
const Triangle ct = tr_.get_incident_triangle(f, v);
3461+
const Triangle ct = this->get_incident_triangle(tr_, f, v);
34633462
triangles.push_back(ct);
34643463
}
34653464
}
@@ -3481,7 +3480,7 @@ get_least_square_surface_plane(const Vertex_handle& v,
34813480

34823481
// The surface center of a facet might have an offset in periodic triangulations
34833482
const Bare_point& ref_facet_scp = ref_facet.first->get_facet_surface_center(ref_facet.second);
3484-
const Bare_point& ref_point = tr_.get_closest_point(cp(position), ref_facet_scp);
3483+
const Bare_point& ref_point = this->get_closest_point(tr_, cp(position), ref_facet_scp);
34853484
return std::make_pair(plane, ref_point);
34863485
}
34873486

@@ -3509,7 +3508,7 @@ project_on_surface_if_possible(const Vertex_handle& v,
35093508
// @todo should call below if it's available...
35103509
// return domain_.project_on_surface(p);
35113510

3512-
typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object();
3511+
auto cp = this->construct_bare_point_object(tr_);
35133512
typename GT::Equal_3 equal = tr_.geom_traits().equal_3_object();
35143513

35153514
// Get plane
@@ -3904,7 +3903,7 @@ get_conflict_zone_after_move_topo_change(const Vertex_handle& new_vertex,
39043903
// `remove_cells_and_facets_from_c3t3()`
39053904
if (lt == Tr::VERTEX)
39063905
{
3907-
CGAL_assertion((std::is_same<typename Tr::Periodic_tag, CGAL::Tag_true>::value));
3906+
CGAL_assertion(is_periodic_triangulation_v<Tr>);
39083907
tr_.incident_cells(cell->vertex(li), std::back_inserter(deleted_cells));
39093908
}
39103909
else

Mesh_3/include/CGAL/Mesh_3/Cell_criteria_visitor_with_balls.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#define CGAL_MESH_3_CELL_CRITERIA_VISITOR_WITH_BALLS_H
1919

2020
#include <CGAL/license/Mesh_3.h>
21+
#include <CGAL/type_traits.h>
2122

2223
#include <CGAL/Mesh_3/mesh_standard_criteria.h>
2324
#include <CGAL/Mesh_3/mesh_standard_cell_criteria.h>
@@ -43,8 +44,8 @@ class Cell_criteria_visitor_with_balls
4344
typedef typename Base::Handle Handle;
4445
typedef Handle Cell_handle;
4546

46-
typedef typename Tr::Bare_point Bare_point;
47-
typedef typename Tr::Weighted_point Weighted_point;
47+
typedef Bare_point_type_t<Tr> Bare_point;
48+
typedef typename Tr::Point Weighted_point;
4849
typedef typename Tr::Geom_traits GT;
4950
typedef typename GT::FT FT;
5051

Mesh_3/include/CGAL/Mesh_3/Construct_initial_points_labeled_image.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ struct Construct_initial_points_labeled_image
153153
typedef typename C3t3::Triangulation Tr;
154154
typedef typename Tr::Geom_traits GT;
155155
typedef typename GT::FT FT;
156-
typedef typename Tr::Weighted_point Weighted_point;
156+
typedef typename Tr::Point Weighted_point;
157157
typedef typename Tr::Segment Segment_3;
158158
typedef typename Tr::Vertex_handle Vertex_handle;
159159
typedef typename Tr::Cell_handle Cell_handle;

0 commit comments

Comments
 (0)