CGAL 6.0.1 - Weights
Loading...
Searching...
No Matches
Weights/weights.cpp
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Weights.h>
// Typedefs.
using FT = typename Kernel::FT;
using Point_2 = typename Kernel::Point_2;
using Point_3 = typename Kernel::Point_3;
int main() {
// 2D configuration.
const Point_2 t2(-1, 0); // p0
const Point_2 r2( 0, -1); // p1
const Point_2 p2( 1, 0); // p2
const Point_2 q2( 0, 0); // query
// 3D configuration.
const Point_3 t3(-1, 0, 1); // p0
const Point_3 r3( 0, -1, 1); // p1
const Point_3 p3( 1, 0, 1); // p2
const Point_3 q3( 0, 0, 1); // query
std::cout << "2D/3D tangent weight: ";
std::cout << CGAL::Weights::tangent_weight(t2, r2, p2, q2) << "/";
std::cout << CGAL::Weights::tangent_weight(t3, r3, p3, q3) << std::endl;
std::cout << "2D/3D Shepard weight: ";
std::cout << CGAL::Weights::shepard_weight(r2, q2, 2.0) << "/";
std::cout << CGAL::Weights::shepard_weight(r3, q3, 2.0) << std::endl;
std::cout << "2D/3D barycentric area: ";
std::cout << CGAL::Weights::barycentric_area(p2, q2, r2) << "/";
std::cout << CGAL::Weights::barycentric_area(p3, q3, r3) << std::endl;
return EXIT_SUCCESS;
}
A convenience header that includes all weights.
GeomTraits::FT barycentric_area(const typename GeomTraits::Point_2 &p, const typename GeomTraits::Point_2 &q, const typename GeomTraits::Point_2 &r, const GeomTraits &traits)
computes the area of the barycentric cell in 2D using the points p, q, and r.
Definition: barycentric_region_weights.h:33
GeomTraits::FT shepard_weight(const typename GeomTraits::Point_2 &, const typename GeomTraits::Point_2 &p, const typename GeomTraits::Point_2 &, const typename GeomTraits::Point_2 &q, const typename GeomTraits::FT a, const GeomTraits &traits)
computes the Shepard weight in 2D using the points p and q and the power parameter a.
Definition: shepard_weights.h:52
GeomTraits::FT tangent_weight(const typename GeomTraits::Point_2 &p0, const typename GeomTraits::Point_2 &p1, const typename GeomTraits::Point_2 &p2, const typename GeomTraits::Point_2 &q, const GeomTraits &traits)
computes the tangent weight in 2D at q using the points p0, p1, and p2
Definition: tangent_weights.h:288