Internal_point.h
1 /* This file is part of the Gudhi Library. The Gudhi library
2  * (Geometric Understanding in Higher Dimensions) is a generic C++
3  * library for computational topology.
4  *
5  * Author: Francois Godi
6  *
7  * Copyright (C) 2015 INRIA
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef INTERNAL_POINT_H_
24 #define INTERNAL_POINT_H_
25 
26 namespace Gudhi {
27 
28 namespace persistence_diagram {
29 
31 int null_point_index();
32 
34 struct Internal_point {
35  double vec[2];
36  int point_index;
37 
38  Internal_point() { }
39 
40  Internal_point(double x, double y, int p_i) {
41  vec[0] = x;
42  vec[1] = y;
43  point_index = p_i;
44  }
45 
46  double x() const {
47  return vec[ 0 ];
48  }
49 
50  double y() const {
51  return vec[ 1 ];
52  }
53 
54  double& x() {
55  return vec[ 0 ];
56  }
57 
58  double& y() {
59  return vec[ 1 ];
60  }
61 
62  bool operator==(const Internal_point& p) const {
63  return point_index == p.point_index;
64  }
65 
66  bool operator!=(const Internal_point& p) const {
67  return !(*this == p);
68  }
69 };
70 
71 inline int null_point_index() {
72  return -1;
73 }
74 
75 struct Construct_coord_iterator {
76  typedef const double* result_type;
77 
78  const double* operator()(const Internal_point& p) const {
79  return p.vec;
80  }
81 
82  const double* operator()(const Internal_point& p, int) const {
83  return p.vec + 2;
84  }
85 };
86 
87 } // namespace persistence_diagram
88 
89 } // namespace Gudhi
90 
91 #endif // INTERNAL_POINT_H_
Definition: SimplicialComplexForAlpha.h:26
GUDHI  Version 2.1.0  - C++ library for Topological Data Analysis (TDA) and Higher Dimensional Geometry Understanding.  - Copyright : GPL v3 Generated on Thu May 24 2018 09:46:12 for GUDHI by Doxygen 1.8.13