Skip to content

WIP Mesh_3 with Delaunay #8805

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ BraceWrapping:
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
ColumnLimit: 120
ColumnLimit: 100
# Force pointers to the type for C++.
DerivePointerAlignment: false
PointerAlignment: Left
Expand Down
2 changes: 1 addition & 1 deletion Alpha_shapes_2/include/CGAL/Alpha_shape_2.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class Alpha_shape_2 : public Dt
// is set to true rely on a permanent and safe access to the points.
static_assert(
(std::is_same<ExactAlphaComparisonTag, Tag_false>::value) ||
(std::is_same<typename Dt::Periodic_tag, Tag_false>::value));
(false == is_periodic_triangulation_v<Dt>));

typedef typename internal::Alpha_nt_selector_2<
Gt, ExactAlphaComparisonTag, typename Dt::Weighted_tag>::Type_of_alpha Type_of_alpha;
Expand Down
2 changes: 1 addition & 1 deletion Alpha_shapes_3/include/CGAL/Alpha_shape_3.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class Alpha_shape_3 : public Dt
// is set to true rely on a permanent and safe access to the points.
static_assert(
(std::is_same<ExactAlphaComparisonTag, Tag_false>::value) ||
(std::is_same<typename Dt::Periodic_tag, Tag_false>::value));
(false == is_periodic_triangulation_v<Dt>));

//extra the type used for representing alpha according to ExactAlphaComparisonTag
typedef typename internal::Alpha_nt_selector_3<Gt,ExactAlphaComparisonTag,typename Dt::Weighted_tag>::Type_of_alpha NT;
Expand Down
5 changes: 3 additions & 2 deletions Generator/include/CGAL/point_generators_3.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define CGAL_POINT_GENERATORS_3_H 1

#include <CGAL/disable_warnings.h>
#include <CGAL/type_traits.h>

#include <CGAL/generators.h>
#include <CGAL/point_generators_2.h>
Expand Down Expand Up @@ -486,7 +487,7 @@ template<class C3T3>
class Triangle_from_c3t3_facet
{
typedef typename C3T3::Triangulation Tr;
typedef typename Tr::Bare_point Bare_point;
typedef Bare_point_type_t<Tr> Bare_point;
typedef typename Tr::Triangle Triangle;
typedef typename Tr::Facet Facet;
typedef typename Tr::Cell_handle Cell_handle;
Expand Down Expand Up @@ -516,8 +517,8 @@ template<class C3T3>
class Tetrahedron_from_c3t3_cell
{
typedef typename C3T3::Triangulation Tr;
typedef Bare_point_type_t<Tr> Bare_point;
typedef typename Tr::Cell_handle Cell;
typedef typename Tr::Bare_point Bare_point;
typedef typename Tr::Tetrahedron Tetrahedron;

public:
Expand Down
1 change: 0 additions & 1 deletion Mesh_3/examples/Mesh_3/mesh_implicit_sphere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,3 @@ int main()

return 0;
}

1 change: 1 addition & 0 deletions Mesh_3/examples/Mesh_3/mesh_polyhedral_domain.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#define CGAL_MESH_3_VERBOSE 1
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>

#include <CGAL/Mesh_triangulation_3.h>
Expand Down
71 changes: 35 additions & 36 deletions Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <CGAL/tuple.h>
#include <CGAL/iterator.h>
#include <CGAL/array.h>
#include <CGAL/type_traits.h>
#include <CGAL/Handle_hash_function.h>

#ifdef CGAL_MESH_3_PROFILING
Expand Down Expand Up @@ -376,8 +377,7 @@ class C3T3_helpers_base
{
protected:
typedef typename Tr::Geom_traits GT;
typedef typename Tr::Bare_point Bare_point;
typedef typename Tr::Weighted_point Weighted_point;
typedef typename Tr::Point Weighted_point;
typedef typename GT::FT FT;
typedef typename Tr::Vertex_handle Vertex_handle;
typedef typename Tr::Cell_handle Cell_handle;
Expand Down Expand Up @@ -448,8 +448,8 @@ class C3T3_helpers_base<Tr, Parallel_tag>
{
protected:
typedef typename Tr::Geom_traits GT;
typedef typename Tr::Bare_point Bare_point;
typedef typename Tr::Weighted_point Weighted_point;
typedef Bare_point_type_t<Tr> Bare_point;
typedef typename Tr::Point Weighted_point;
typedef typename Tr::Vertex_handle Vertex_handle;
typedef typename Tr::Cell_handle Cell_handle;
typedef typename Tr::Facet Facet;
Expand Down Expand Up @@ -609,7 +609,8 @@ template <typename C3T3,
typename MeshDomain>
class C3T3_helpers
: public C3T3_helpers_base<typename C3T3::Triangulation,
typename C3T3::Concurrency_tag>
typename C3T3::Concurrency_tag>,
public CGAL::Mesh_3::Triangulation_helpers<typename C3T3::Triangulation>
{
// -----------------------------------
// Private types
Expand All @@ -625,8 +626,8 @@ class C3T3_helpers
typedef typename Tr::Geom_traits GT;

typedef typename GT::FT FT;
typedef typename Tr::Bare_point Bare_point;
typedef typename Tr::Weighted_point Weighted_point;
typedef typename Tr::Point Weighted_point;
typedef Bare_point_type_t<Tr> Bare_point;
typedef typename GT::Vector_3 Vector_3;
typedef typename GT::Plane_3 Plane_3;
typedef typename GT::Tetrahedron_3 Tetrahedron;
Expand All @@ -640,8 +641,8 @@ class C3T3_helpers
typedef typename C3T3::Subdomain_index Subdomain_index;
typedef typename C3T3::Index Index;

typedef std::optional<Surface_patch_index> Surface_patch;
typedef std::optional<Subdomain_index> Subdomain;
typedef std::optional<Surface_patch_index> Surface_patch;
typedef std::optional<Subdomain_index> Subdomain;

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

template <typename CellForwardIterator>
void reset_circumcenter_cache(CellForwardIterator cells_begin,
CellForwardIterator cells_end) const
CellForwardIterator cells_end) const
{
while(cells_begin != cells_end) {
(*cells_begin)->invalidate_weighted_circumcenter_cache();
++cells_begin;
}
if constexpr(is_regular_triangulation_v<Tr>)
for(auto it = cells_begin; it != cells_end; ++it)
(*it)->invalidate_weighted_circumcenter_cache();
}


private:

// Functor for update_facets function (base)
Expand Down Expand Up @@ -2436,7 +2435,7 @@ update_mesh(const Vertex_handle& old_vertex,
Cell_vector incident_cells_;
incident_cells_.reserve(64);
tr_.incident_cells(old_vertex, std::back_inserter(incident_cells_));
if ( Th().no_topological_change(tr_, old_vertex, move, new_position, incident_cells_) )
if ( this->no_topological_change(tr_, old_vertex, move, new_position, incident_cells_) )
{
return update_mesh_no_topo_change(old_vertex, move, new_position, criterion,
modified_vertices, incident_cells_);
Expand Down Expand Up @@ -2674,7 +2673,7 @@ C3T3_helpers<C3T3,MD>::
rebuild_restricted_delaunay(OutdatedCells& outdated_cells,
Moving_vertices_set& moving_vertices)
{
typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object();
auto cp = this->construct_bare_point_object(tr_);

typename OutdatedCells::iterator first_cell = outdated_cells.begin();
typename OutdatedCells::iterator last_cell = outdated_cells.end();
Expand Down Expand Up @@ -2804,7 +2803,7 @@ rebuild_restricted_delaunay(ForwardIterator first_cell,
ForwardIterator last_cell,
Moving_vertices_set& moving_vertices)
{
typename GT::Construct_point_3 cp = tr_.geom_traits().construct_point_3_object();
auto cp = this->construct_bare_point_object(tr_);
typename GT::Construct_vector_3 vector = tr_.geom_traits().construct_vector_3_object();
typename GT::Equal_3 equal = tr_.geom_traits().equal_3_object();

Expand Down Expand Up @@ -2943,29 +2942,29 @@ move_point(const Vertex_handle& old_vertex,
#endif

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

Cell_vector incident_cells_;
incident_cells_.reserve(64);

# ifdef CGAL_LINKED_WITH_TBB
#ifdef CGAL_LINKED_WITH_TBB
// Parallel
if (std::is_convertible<Concurrency_tag, Parallel_tag>::value)
{
tr_.incident_cells_threadsafe(old_vertex, std::back_inserter(incident_cells_));
}
// Sequential
else
# endif // CGAL_LINKED_WITH_TBB
#endif // CGAL_LINKED_WITH_TBB
{
tr_.incident_cells(old_vertex, std::back_inserter(incident_cells_));
}

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

if ( Th().no_topological_change(tr_, old_vertex, move, new_position, incident_cells_) )
if ( this->no_topological_change(tr_, old_vertex, move, new_position, incident_cells_) )
{
reset_circumcenter_cache(incident_cells_);
reset_sliver_cache(incident_cells_);
Expand Down Expand Up @@ -2994,8 +2993,8 @@ move_point(const Vertex_handle& old_vertex,
#endif

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

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

if ( Th().no_topological_change(tr_, old_vertex, move, new_position, incident_cells_) )
if ( this->no_topological_change(tr_, old_vertex, move, new_position, incident_cells_) )
{
reset_circumcenter_cache(incident_cells_);
reset_sliver_cache(incident_cells_);
Expand Down Expand Up @@ -3058,8 +3057,8 @@ move_point(const Vertex_handle& old_vertex,
//======= /Get incident cells ==========

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

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

if ( Th().no_topological_change(tr_, old_vertex, move, new_position, incident_cells_) )
if ( this->no_topological_change(tr_, old_vertex, move, new_position, incident_cells_) )
{
reset_circumcenter_cache(incident_cells_);
reset_sliver_cache(incident_cells_);
Expand Down Expand Up @@ -3349,7 +3348,7 @@ move_point_no_topo_change(const Vertex_handle& old_vertex,
const Weighted_point& new_position) const
{
// Change vertex position
tr_.set_point(old_vertex, move, new_position);
this->set_point(tr_, old_vertex, move, new_position);
CGAL_expensive_postcondition(tr_.is_valid());
return old_vertex;
}
Expand Down Expand Up @@ -3427,7 +3426,7 @@ get_least_square_surface_plane(const Vertex_handle& v,
{
typedef typename C3T3::Triangulation::Triangle Triangle;

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

// Get incident facets
Facet_vector facets;
Expand Down Expand Up @@ -3459,7 +3458,7 @@ get_least_square_surface_plane(const Vertex_handle& v,
if(ref_facet.first == Cell_handle())
ref_facet = f;

const Triangle ct = tr_.get_incident_triangle(f, v);
const Triangle ct = this->get_incident_triangle(tr_, f, v);
triangles.push_back(ct);
}
}
Expand All @@ -3481,7 +3480,7 @@ get_least_square_surface_plane(const Vertex_handle& v,

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

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

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

// Get plane
Expand Down Expand Up @@ -3904,7 +3903,7 @@ get_conflict_zone_after_move_topo_change(const Vertex_handle& new_vertex,
// `remove_cells_and_facets_from_c3t3()`
if (lt == Tr::VERTEX)
{
CGAL_assertion((std::is_same<typename Tr::Periodic_tag, CGAL::Tag_true>::value));
CGAL_assertion(is_periodic_triangulation_v<Tr>);
tr_.incident_cells(cell->vertex(li), std::back_inserter(deleted_cells));
}
else
Expand Down
5 changes: 3 additions & 2 deletions Mesh_3/include/CGAL/Mesh_3/Cell_criteria_visitor_with_balls.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#define CGAL_MESH_3_CELL_CRITERIA_VISITOR_WITH_BALLS_H

#include <CGAL/license/Mesh_3.h>
#include <CGAL/type_traits.h>

#include <CGAL/Mesh_3/mesh_standard_criteria.h>
#include <CGAL/Mesh_3/mesh_standard_cell_criteria.h>
Expand All @@ -43,8 +44,8 @@ class Cell_criteria_visitor_with_balls
typedef typename Base::Handle Handle;
typedef Handle Cell_handle;

typedef typename Tr::Bare_point Bare_point;
typedef typename Tr::Weighted_point Weighted_point;
typedef Bare_point_type_t<Tr> Bare_point;
typedef typename Tr::Point Weighted_point;
typedef typename Tr::Geom_traits GT;
typedef typename GT::FT FT;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ struct Construct_initial_points_labeled_image
typedef typename C3t3::Triangulation Tr;
typedef typename Tr::Geom_traits GT;
typedef typename GT::FT FT;
typedef typename Tr::Weighted_point Weighted_point;
typedef typename Tr::Point Weighted_point;
typedef typename Tr::Segment Segment_3;
typedef typename Tr::Vertex_handle Vertex_handle;
typedef typename Tr::Cell_handle Cell_handle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#define CGAL_MESH_3_FACET_CRITERIA_VISITOR_WITH_BALLS_H

#include <CGAL/license/Mesh_3.h>
#include <CGAL/type_traits.h>

#include <CGAL/Mesh_3/mesh_standard_criteria.h>
#include <CGAL/Mesh_3/mesh_standard_facet_criteria.h>
Expand Down Expand Up @@ -48,8 +49,8 @@ class Facet_criterion_visitor_with_balls
typedef typename Base::Handle Handle;
typedef Handle Facet;

typedef typename Tr::Bare_point Bare_point;
typedef typename Tr::Weighted_point Weighted_point;
typedef Bare_point_type_t<Tr> Bare_point;
typedef typename Tr::Point Weighted_point;
typedef typename Tr::Geom_traits GT;
typedef typename GT::FT FT;

Expand Down Expand Up @@ -202,7 +203,7 @@ class Facet_criterion_visitor_with_balls
// Base::do_visit(criterion);
// }

}; // end class Facet_criterion_visitor
}; // end class Facet_criterion_visitor_with_balls


} //end namespace Mesh_3
Expand Down
6 changes: 3 additions & 3 deletions Mesh_3/include/CGAL/Mesh_3/Facet_on_same_surface_criterion.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,18 @@ namespace Mesh_3 {
// virtual ~Facet_on_same_surface_criterion() {};
//
//protected:
// virtual void do_accept(Visitor_& v) const
// void do_accept(Visitor_& v) const override
// {
// v.visit(*this);
// }
//
// virtual Self* do_clone() const
// Self* do_clone() const override
// {
// // Call copy ctor on this
// return new Self(*this);
// }
//
// virtual Is_bad do_is_bad (const Tr& tr, Facet& f) const
// Is_bad do_is_bad (const Tr& tr, Facet& f) const override
// {
// typedef typename Tr::Vertex_handle Vertex_handle;
// typedef typename Tr::Cell_handle Cell_handle;
Expand Down
Loading