#include <CGAL/Simple_cartesian.h>
#include <CGAL/Weights/discrete_harmonic_weights.h>
int main() {
const std::vector<Point_2> polygon =
{ Point_2(0, 0), Point_2(1, 0), Point_2(1, 1), Point_2(0, 1) };
const Point_2 query(0.5, 0.5);
std::vector<FT> weights;
weights.reserve(polygon.size());
std::vector<FT> coordinates;
coordinates.reserve(polygon.size());
assert(weights.size() == polygon.size());
std::cout << "2D weights: ";
for (const FT weight : weights) {
std::cout << weight << " ";
}
std::cout << std::endl;
FT sum = 0.0;
for (const FT weight : weights) {
sum += weight;
}
assert(sum != 0.0);
for (const FT weight : weights) {
coordinates.push_back(weight / sum);
}
assert(coordinates.size() == weights.size());
std::cout << "2D coordinates: ";
for (const FT coordinate : coordinates) {
std::cout << coordinate << " ";
}
std::cout << std::endl;
return EXIT_SUCCESS;
}