mirror of https://github.com/CGAL/cgal
Merge remote-tracking branch 'origin/Weights-new_package-danston' into Barycentric_coordinates_2-danston
This commit is contained in:
commit
bf51bcb50d
|
|
@ -2,9 +2,8 @@
|
|||
\ingroup PkgWeightsRefConcepts
|
||||
\cgalConcept
|
||||
|
||||
A concept that describes the set of requirements of the template parameter
|
||||
`GeomTraits` used to parameterize several classes and functions
|
||||
from the namespace `CGAL::Weights`.
|
||||
A concept that describes the set of requirements of classes used in the computation
|
||||
of analytic weights in 2D.
|
||||
|
||||
\cgalHasModel
|
||||
- All models of `Kernel`
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@
|
|||
\ingroup PkgWeightsRefConcepts
|
||||
\cgalConcept
|
||||
|
||||
A concept that describes the set of requirements of the template parameter
|
||||
`GeomTraits` used to parameterize several classes and functions
|
||||
from the namespace `CGAL::Weights`.
|
||||
A concept that describes the set of requirements of classes used in the computation
|
||||
of analytic weights in 3D.
|
||||
|
||||
\cgalHasModel
|
||||
- All models of `Kernel`
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ int main() {
|
|||
|
||||
// Choose a type of the weight:
|
||||
// e.g. 0 - Wachspress (WP) weight; 1 - mean value (MV);
|
||||
const FT wp = FT(0);
|
||||
const FT mv = FT(1);
|
||||
const FT wp = 0.0;
|
||||
const FT mv = 1.0;
|
||||
|
||||
// Compute WP and MV weights.
|
||||
std::cout << "3D Wachspress (WP, q0): ";
|
||||
|
|
@ -29,8 +29,8 @@ int main() {
|
|||
|
||||
// Converge WP towards MV.
|
||||
std::cout << "Converge WP to MV on q0: " << std::endl;
|
||||
const FT step = FT(1) / FT(10);
|
||||
for (FT x = FT(0); x <= FT(1); x += step) {
|
||||
const FT step = 0.1;
|
||||
for (FT x = 0.0; x <= 1.0; x += step) {
|
||||
std::cout << "3D x: ";
|
||||
std::cout << CGAL::Weights::three_point_family_weight(p0, p1, p2, q0, x) << std::endl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ int main() {
|
|||
// Generate a set of query points.
|
||||
std::vector<Point_2> queries;
|
||||
queries.reserve(num_queries);
|
||||
Generator generator(FT(1));
|
||||
Generator generator(1.0);
|
||||
std::copy_n(generator, num_queries, std::back_inserter(queries));
|
||||
assert(queries.size() == num_queries);
|
||||
|
||||
|
|
@ -51,11 +51,11 @@ int main() {
|
|||
|
||||
// Normalize weights in order to get barycentric coordinates.
|
||||
for (std::size_t i = 0; i < weights.size(); i += polygon.size()) {
|
||||
FT sum = FT(0);
|
||||
FT sum = 0.0;
|
||||
for (std::size_t j = 0; j < polygon.size(); ++j) {
|
||||
sum += weights[i + j];
|
||||
}
|
||||
assert(sum != FT(0));
|
||||
assert(sum != 0.0);
|
||||
for (std::size_t j = 0; j < polygon.size(); ++j) {
|
||||
coordinates.push_back(weights[i + j] / sum);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,11 +30,11 @@ int main() {
|
|||
std::cout << std::endl;
|
||||
|
||||
// Normalize weights in order to get barycentric coordinates.
|
||||
FT sum = FT(0);
|
||||
FT sum = 0.0;
|
||||
for (const FT weight : weights) {
|
||||
sum += weight;
|
||||
}
|
||||
assert(sum != FT(0));
|
||||
assert(sum != 0.0);
|
||||
for (const FT weight : weights) {
|
||||
coordinates.push_back(weight / sum);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,13 +49,13 @@ FT get_w_ij(const Mesh& mesh, const HD he, const PointMap pmap) {
|
|||
|
||||
const auto& p0 = get(pmap, v2); // neighbor jm
|
||||
const auto& p2 = get(pmap, v3); // neighbor jp
|
||||
return CGAL::Weights::cotangent_weight(p0, p1, p2, q) / FT(2);
|
||||
return CGAL::Weights::cotangent_weight(p0, p1, p2, q) / 2.0;
|
||||
}
|
||||
|
||||
template<typename PointMap>
|
||||
FT get_w_i(const Mesh& mesh, const VD v_i, const PointMap pmap) {
|
||||
|
||||
FT A_i = FT(0);
|
||||
FT A_i = 0.0;
|
||||
const auto v0 = v_i;
|
||||
const auto init = halfedge(v_i, mesh);
|
||||
for (const auto& he : halfedges_around_target(init, mesh)) {
|
||||
|
|
@ -70,8 +70,8 @@ FT get_w_i(const Mesh& mesh, const VD v_i, const PointMap pmap) {
|
|||
const auto& r = get(pmap, v2);
|
||||
A_i += CGAL::Weights::mixed_voronoi_area(p, q, r);
|
||||
}
|
||||
assert(A_i != FT(0));
|
||||
return FT(1) / (FT(2) * A_i);
|
||||
assert(A_i != 0.0);
|
||||
return 1.0 / (2.0 * A_i);
|
||||
}
|
||||
|
||||
void set_laplacian_matrix(const Mesh& mesh, Matrix& L) {
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ int main() {
|
|||
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, FT(2)) << "/";
|
||||
std::cout << CGAL::Weights::shepard_weight(r3, q3, FT(2)) << std::endl;
|
||||
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) << "/";
|
||||
|
|
|
|||
|
|
@ -103,7 +103,13 @@ namespace Weights {
|
|||
const GeomTraits traits;
|
||||
return cotangent(p, q, r, traits);
|
||||
}
|
||||
/// \endcond
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
// These are free functions to be used when building weights from parts rather
|
||||
// than using the predefined weight functions. In principle, they can be removed.
|
||||
// They are here to have unified interface within the Weights package and its
|
||||
// construction weight system.
|
||||
template<typename GeomTraits>
|
||||
typename GeomTraits::FT squared_distance(
|
||||
const CGAL::Point_2<GeomTraits>& p,
|
||||
|
|
|
|||
Loading…
Reference in New Issue