CGAL 5.6.3 - Weights

Loading...
Searching...
No Matches
Weights/custom_traits.cpp
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Weights/inverse_distance_weights.h>
// Typedefs.
using Kernel = CGAL::Simple_cartesian<double>;
using Point_2 = typename Kernel::Point_2;
using Point_3 = typename Kernel::Point_3;
// Custom traits class that has only two objects.
struct Custom_traits {
using FT = typename Kernel::FT;
using Point_2 = typename Kernel::Point_2;
using Point_3 = typename Kernel::Point_3;
decltype(auto) compute_squared_distance_2_object() const {
return Kernel::Compute_squared_distance_2();
}
decltype(auto) compute_squared_distance_3_object() const {
return Kernel::Compute_squared_distance_3();
}
};
int main() {
// 2D configuration.
const Point_2 p2(0, 0);
const Point_2 q2(0, 1);
// 3D configuration.
const Point_3 p3(0, 0, 1);
const Point_3 q3(0, 1, 1);
// Create custom traits.
const Custom_traits ctraits;
// Compute weights.
std::cout << "2D/3D weight: ";
std::cout << CGAL::Weights::inverse_distance_weight(p2, q2, ctraits) << "/";
std::cout << CGAL::Weights::inverse_distance_weight(p3, q3, ctraits) << std::endl;
return EXIT_SUCCESS;
}
Kernel::Point_2
Kernel::Point_3
CGAL::Weights::inverse_distance_weight
GeomTraits::FT inverse_distance_weight(const typename GeomTraits::Point_2 &, const typename GeomTraits::Point_2 &p, const typename GeomTraits::Point_2 &, const typename GeomTraits::Point_2 &q, const GeomTraits &traits)
computes the inverse distance weight in 2D using the points p and q.
Definition: inverse_distance_weights.h:49
Kernel
CGAL::Simple_cartesian