Added is_one_to_one_mapping() to all parameterizers

This commit is contained in:
Mael Rouxel-Labbé 2016-11-09 14:14:18 +01:00
parent 8da6683ef0
commit a52040fb4e
4 changed files with 55 additions and 1 deletions

View File

@ -1245,6 +1245,20 @@ private:
// Public operations
public:
/// Check if the 3D -> 2D mapping is one-to-one.
template <typename VertexUVMap>
bool is_one_to_one_mapping(const TriangleMesh& mesh,
const VertexUVMap uvmap) const
{
/// Theorem: A one-to-one mapping is guaranteed if all w_ij coefficients
/// are > 0 (for j vertex neighbor of i) and if the surface
/// border is mapped onto a 2D convex polygon.
/// Here, all w_ij coefficients = 1 (for j vertex neighbor of i), thus a
/// valid embedding is guaranteed if the surface border is mapped
/// onto a 2D convex polygon.
return internal::Parameterization::is_one_to_one_mapping(mesh, uvmap);
}
/// Compute a mapping from a triangular 3D surface mesh to a piece of the 2D space.
/// The mapping is piecewise linear (linear in each triangle).
/// The result is the (u,v) pair image of each vertex of the 3D surface.

View File

@ -24,6 +24,7 @@
#include <CGAL/license/Surface_mesh_parameterization.h>
#include <CGAL/internal/Surface_mesh_parameterization/validity.h>
#include <CGAL/Circular_border_parameterizer_3.h>
#include <CGAL/Fixed_border_parameterizer_3.h>
#include <CGAL/Eigen_solver_traits.h>
@ -118,6 +119,21 @@ public:
// Default copy constructor and operator =() are fine
/// Check if the 3D -> 2D mapping is one-to-one.
template <typename VertexUVMap>
bool is_one_to_one_mapping(const TriangleMesh& mesh,
const VertexUVMap uvmap) const
{
/// Theorem: A one-to-one mapping is guaranteed if all w_ij coefficients
/// are > 0 (for j vertex neighbor of i) and if the surface
/// border is mapped onto a 2D convex polygon.
/// Here, all w_ij coefficients = 1 (for j vertex neighbor of i), thus a
/// valid embedding is guaranteed if the surface border is mapped
/// onto a 2D convex polygon.
return (Base::get_border_parameterizer().is_border_convex() ||
internal::Parameterization::is_one_to_one_mapping(mesh, uvmap));
}
// Protected operations
protected:
/// Compute w_ij = (i,j), coefficient of matrix A for j neighbor vertex of i.

View File

@ -24,6 +24,7 @@
#include <CGAL/license/Surface_mesh_parameterization.h>
#include <CGAL/internal/Surface_mesh_parameterization/Containers_filler.h>
#include <CGAL/internal/Surface_mesh_parameterization/validity.h>
#include <CGAL/Parameterizer_traits_3.h>
#include <CGAL/Two_vertices_parameterizer_3.h>
@ -147,6 +148,14 @@ public:
// Default copy constructor and operator =() are fine
/// Check if the 3D -> 2D mapping is one-to-one.
template <typename VertexUVMap>
bool is_one_to_one_mapping(const TriangleMesh& mesh,
const VertexUVMap uvmap) const
{
return internal::Parameterization::is_one_to_one_mapping(mesh, uvmap);
}
/// Compute a one-to-one mapping from a triangular 3D surface mesh
/// to a piece of the 2D space.
/// The mapping is piecewise linear (linear in each triangle).

View File

@ -23,7 +23,7 @@
#include <CGAL/license/Surface_mesh_parameterization.h>
#include <CGAL/internal/Surface_mesh_parameterization/validity.h>
#include <CGAL/Fixed_border_parameterizer_3.h>
#include <CGAL/Eigen_solver_traits.h>
@ -129,6 +129,21 @@ public:
// Default copy constructor and operator =() are fine
/// Check if the 3D -> 2D mapping is one-to-one.
template <typename VertexUVMap>
bool is_one_to_one_mapping(const TriangleMesh& mesh,
const VertexUVMap uvmap) const
{
/// Theorem: A one-to-one mapping is guaranteed if all w_ij coefficients
/// are > 0 (for j vertex neighbor of i) and if the surface
/// border is mapped onto a 2D convex polygon.
/// Here, all w_ij coefficients are positive (for j vertex neighbor of i), thus a
/// valid embedding is guaranteed if the surface border is mapped
/// onto a 2D convex polygon.
return (Base::get_border_parameterizer().is_border_convex() ||
internal::Parameterization::is_one_to_one_mapping(mesh, uvmap));
}
// Protected operations
protected:
/// Compute w_ij = (i, j) coefficient of matrix A for j neighbor vertex of i.