#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Barycentric_coordinates_2/Delaunay_domain_2.h>
#include <CGAL/Barycentric_coordinates_2/Harmonic_coordinates_2.h>
using Point_range = std::vector<Point_2>;
using Domain =
using Harmonic_coordinates_2 =
int main() {
const std::vector<Point_2> source_shape = {
Point_2(1, 0), Point_2(2, 0), Point_2(3, 3), Point_2(4, 0), Point_2(5, 0),
Point_2(4, 3), Point_2(4, 5), Point_2(5, 4), Point_2(5, 5), Point_2(4, 6),
Point_2(2, 6), Point_2(1, 5), Point_2(1, 4), Point_2(2, 5), Point_2(2, 3)
};
const std::vector<Point_2> target_shape = {
Point_2(2, 0), Point_2(3, 0), Point_2(3, 3), Point_2(3, 0), Point_2(4, 0),
Point_2(4, 3), Point_2(4, 5), Point_2(5, 6), Point_2(5, 7), Point_2(4, 6),
Point_2(2, 6), Point_2(1, 7), Point_2(1, 6), Point_2(2, 5), Point_2(2, 3)
};
assert(target_shape.size() == source_shape.size());
const std::vector<Point_2> seeds = { Point_2(3, 5) };
const FT max_edge_length = FT(1) / FT(3);
Domain domain(source_shape);
domain.create(max_edge_length, seeds);
std::vector< std::vector<FT> > coordinates;
coordinates.reserve(domain.number_of_vertices());
Harmonic_coordinates_2 harmonic_coordinates_2(source_shape, domain);
harmonic_coordinates_2.compute();
harmonic_coordinates_2(std::back_inserter(coordinates));
std::cout << std::endl << "shape deformation: " << std::endl << std::endl;
for (std::size_t k = 0; k < 20; ++k) {
FT x = FT(0), y = FT(0);
for (std::size_t i = 0; i < coordinates[k].size(); ++i) {
x += coordinates[k][i] * target_shape[i].x();
y += coordinates[k][i] * target_shape[i].y();
}
std::cout << "deformed domain vertex: (" << x << ", " << y << ")" << std::endl;
}
std::cout << std::endl;
return EXIT_SUCCESS;
}