summaryrefslogtreecommitdiff
path: root/src/Alpha_complex/include
diff options
context:
space:
mode:
authorROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-09-11 11:55:55 +0200
committerROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-09-11 11:55:55 +0200
commit171ddab9b7a50f0303d7201fa547dbfb445f9698 (patch)
treee8464dd61a45c9c6a84b929e3eb00692f186d6b2 /src/Alpha_complex/include
parent9922407fe6f5d8872522157555c3573e95930ac3 (diff)
Requires CGAL >= 5.1. Fix is_gabriel computation
Diffstat (limited to 'src/Alpha_complex/include')
-rw-r--r--src/Alpha_complex/include/gudhi/Alpha_complex.h8
-rw-r--r--src/Alpha_complex/include/gudhi/Alpha_complex/Alpha_kernel_d.h17
2 files changed, 10 insertions, 15 deletions
diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex.h b/src/Alpha_complex/include/gudhi/Alpha_complex.h
index 8e9fe773..4316d9bc 100644
--- a/src/Alpha_complex/include/gudhi/Alpha_complex.h
+++ b/src/Alpha_complex/include/gudhi/Alpha_complex.h
@@ -210,6 +210,11 @@ class Alpha_complex {
<< std::endl;
#endif
+#if CGAL_VERSION_NR < 1050101000
+ // Make compilation fail if weighted and CGAL < 5.1
+ static_assert(!Weighted, "Weighted Alpha_complex is only available for CGAL >= 5.1");
+#endif
+
auto first = std::begin(points);
auto last = std::end(points);
@@ -457,8 +462,7 @@ class Alpha_complex {
while(shortiter != enditer && *longiter == *shortiter) { ++longiter; ++shortiter; }
Vertex_handle extra = *longiter;
auto const& cache=get_cache(complex, f_boundary);
- bool is_gab = kernel_.get_squared_distance(kernel_.get_circumcenter(cache), get_point_(extra)) >=
- kernel_.get_squared_radius(cache);
+ bool is_gab = kernel_.is_gabriel(cache, get_point_(extra));
#ifdef DEBUG_TRACES
std::clog << " | Tau is_gabriel(Sigma)=" << is_gab << " - vertexForGabriel=" << extra << std::endl;
#endif // DEBUG_TRACES
diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex/Alpha_kernel_d.h b/src/Alpha_complex/include/gudhi/Alpha_complex/Alpha_kernel_d.h
index a3e3845a..b64e4f59 100644
--- a/src/Alpha_complex/include/gudhi/Alpha_complex/Alpha_kernel_d.h
+++ b/src/Alpha_complex/include/gudhi/Alpha_complex/Alpha_kernel_d.h
@@ -71,13 +71,8 @@ class Alpha_kernel_d<Kernel, false> {
return sph.second;
}
- auto get_circumcenter(const Sphere& sph) const {
- return sph.first;
- }
-
- template<class Point>
- FT get_squared_distance(const Point& first, const Point& second) const {
- return kernel_.squared_distance_d_object()(first, second);
+ bool is_gabriel(const Sphere& circumcenter, const Point_d& point) {
+ return kernel_.squared_distance_d_object()(circumcenter.first, point) >= circumcenter.second;
}
};
@@ -116,12 +111,8 @@ class Alpha_kernel_d<Kernel, true> {
return sph.weight();
}
- auto get_circumcenter(const Sphere& sph) const {
- return sph;
- }
-
- FT get_squared_distance(const Weighted_point_d& first, const Weighted_point_d& second) const {
- return kernel_.power_distance_d_object()(first, second);
+ bool is_gabriel(const Sphere& circumcenter, const Weighted_point_d& point) {
+ return kernel_.power_distance_d_object()(circumcenter, point) >= 0;
}
};