1 // Copyright (c) 1997, 2012 INRIA Sophia-Antipolis (France).
2 // All rights reserved.
3 //
4 // This file is part of CGAL (www.cgal.org).
5 //
6 // $URL: https://github.com/CGAL/cgal/blob/v5.3/Alpha_shapes_3/include/CGAL/Alpha_shape_cell_base_3.h $
7 // $Id: Alpha_shape_cell_base_3.h 0779373 2020-03-26T13:31:46+01:00 Sébastien Loriot
8 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
9 //
10 // Author(s)     : Tran Kai Frank DA
11 
12 #ifndef CGAL_ALPHA_SHAPE_CELL_BASE_3_H
13 #define CGAL_ALPHA_SHAPE_CELL_BASE_3_H
14 
15 #include <CGAL/license/Alpha_shapes_3.h>
16 
17 #include <vector>
18 #include <CGAL/Compact_container.h>
19 #include <CGAL/Delaunay_triangulation_cell_base_3.h>
20 #include <CGAL/internal/Lazy_alpha_nt_3.h>
21 #include <CGAL/Default.h>
22 
23 namespace CGAL {
24 
25 template < class NT_>
26 class  Alpha_status
27 : public Compact_container_base
28 {
29   bool _is_Gabriel;
30   bool _is_on_chull;
31   NT_ _alpha_min;
32   NT_ _alpha_mid;
33   NT_ _alpha_max;
34 
35 public:
36   typedef NT_ NT;
Alpha_status()37   Alpha_status() : _is_Gabriel(false), _is_on_chull(false) {}
set_alpha_min(NT alpha)38   void set_alpha_min(NT alpha) {_alpha_min = alpha;}
set_alpha_mid(NT alpha)39   void set_alpha_mid(NT alpha) {_alpha_mid = alpha;}
set_alpha_max(NT alpha)40   void set_alpha_max(NT alpha) {_alpha_max = alpha;}
set_is_Gabriel(bool yesorno)41   void set_is_Gabriel(bool yesorno) { _is_Gabriel = yesorno;}
set_is_on_chull(bool yesorno)42   void set_is_on_chull(bool yesorno) {_is_on_chull = yesorno;}
alpha_min()43   NT alpha_min() const { return _alpha_min;}
alpha_mid()44   NT alpha_mid() const { return _alpha_mid;}
alpha_max()45   NT alpha_max() const { return _alpha_max;}
is_Gabriel()46   bool is_Gabriel() const {return _is_Gabriel;}
is_on_chull()47   bool is_on_chull() const {return  _is_on_chull;}
48 };
49 
50 template < class Gt,
51            class Cb_ = Default,
52            class ExactAlphaComparisonTag = Tag_false,
53            class Weighted_tag = Tag_false >
54 class Alpha_shape_cell_base_3
55   : public Default::Get<Cb_, Delaunay_triangulation_cell_base_3<Gt> >::type
56 {
57   typedef typename Default::Get<Cb_, Delaunay_triangulation_cell_base_3<Gt> >::type Cb;
58 public:
59   typedef typename Cb::Vertex_handle   Vertex_handle;
60   typedef typename Cb::Cell_handle     Cell_handle;
61 
62   template < typename TDS2 >
63   struct Rebind_TDS {
64     typedef typename Cb::template Rebind_TDS<TDS2>::Other   Cb2;
65     typedef Alpha_shape_cell_base_3<Gt, Cb2,ExactAlphaComparisonTag,Weighted_tag>                Other;
66   };
67 
68   typedef typename internal::Alpha_nt_selector_3<
69     Gt,ExactAlphaComparisonTag,Weighted_tag>::Type_of_alpha  NT;
70   typedef CGAL::Alpha_status<NT>                             Alpha_status;
71   typedef Compact_container<Alpha_status>                    Alpha_status_container;
72   typedef typename Alpha_status_container::const_iterator    Alpha_status_const_iterator;
73   typedef typename Alpha_status_container::iterator          Alpha_status_iterator;
74 
75 private:
76   Alpha_status_iterator facet_status[4];
77   NT A;
78 
79 public:
Alpha_shape_cell_base_3()80   Alpha_shape_cell_base_3()
81     : Cb() {}
82 
Alpha_shape_cell_base_3(Vertex_handle v0,Vertex_handle v1,Vertex_handle v2,Vertex_handle v3)83   Alpha_shape_cell_base_3(Vertex_handle v0, Vertex_handle v1,
84                           Vertex_handle v2, Vertex_handle v3)
85     : Cb(v0, v1, v2, v3) {}
86 
Alpha_shape_cell_base_3(Vertex_handle v0,Vertex_handle v1,Vertex_handle v2,Vertex_handle v3,Cell_handle n0,Cell_handle n1,Cell_handle n2,Cell_handle n3)87   Alpha_shape_cell_base_3(Vertex_handle v0, Vertex_handle v1,
88                           Vertex_handle v2, Vertex_handle v3,
89                           Cell_handle n0, Cell_handle n1,
90                           Cell_handle n2, Cell_handle n3)
91     : Cb(v0, v1, v2, v3, n0, n1, n2, n3) {}
92 
get_alpha()93   NT get_alpha() const { return A; }
set_alpha(const NT & AA)94   void set_alpha(const NT & AA) { A = AA;}
95 
get_facet_status(int i)96   Alpha_status_iterator get_facet_status(int i) {return facet_status[i]; }
get_facet_status(int i)97   Alpha_status_const_iterator get_facet_status(int i) const { return facet_status[i]; }
98 
set_facet_status(int i,Alpha_status_iterator as)99   void set_facet_status(int i, Alpha_status_iterator as) { facet_status[i]= as; }
100 };
101 
102 } // namespace CGAL
103 
104 #endif // CGAL_ALPHA_SHAPE_CELL_BASE_3_H
105