18 #include <igl/cotmatrix.h> 19 #include <igl/per_vertex_normals.h> 25 template <
class T =
float>
26 using VertexMatrix = Eigen::Matrix<T, Eigen::Dynamic, 3>;
27 template <
class T =
float>
using NormalMatrix = VertexMatrix<T>;
29 Eigen::Matrix<typename Mesh<float>::Index, Eigen::Dynamic, 3>;
31 Eigen::Matrix<typename Mesh<float>::Label, Eigen::Dynamic, 1>;
32 template <
class T =
float>
using LaplacianMatrix = Eigen::SparseMatrix<T>;
38 return Eigen::Map<Eigen::Matrix<T, 3, Eigen::Dynamic>
const>{
39 ptr, 3, gsl::narrow<Eigen::Index>(mesh.
vertexCount())};
49 return Eigen::Map<Eigen::Matrix<Index, 3, Eigen::Dynamic>
const>{
59 return Eigen::Map<Eigen::Matrix<Label, Eigen::Dynamic, 1>
const>{
60 ptr, gsl::narrow<Eigen::Index>(mesh.
vertexCount())};
65 template <
class DerivedV,
class DerivedF>
66 inline NormalMatrix<typename DerivedV::Scalar>
68 Eigen::MatrixBase<DerivedF>
const &F) {
70 NormalMatrix<typename DerivedV::Scalar> normals;
72 igl::per_vertex_normals(V, F, igl::PER_VERTEX_NORMALS_WEIGHTING_TYPE_ANGLE,
85 template <
class DerivedV,
class DerivedF>
86 inline LaplacianMatrix<typename DerivedV::Scalar>
88 Eigen::MatrixBase<DerivedF>
const &F) {
90 Eigen::SparseMatrix<typename DerivedV::Scalar> laplacian;
91 Expects(V.rows() > 0 && V.cols() == 3);
92 Expects(F.rows() > 0 && F.cols() == 3);
93 igl::cotmatrix(V, F, laplacian);
Name namespace for CortidQCT library.
Definition: CortidQCT.h:23
auto withUnsafeIndexPointer(F &&f) const noexcept(noexcept(f(std::declval< const IndexData >().data())))
Calls the given functional with an unsafe pointer to the raw index storage.
Definition: Mesh.h:372
VertexMatrix< T > vertexMatrix(Mesh< T > const &mesh)
Returns the Nx3 vertex matrix of the mesh.
Definition: MeshHelpers.h:35
std::ptrdiff_t Index
Index type.
Definition: Mesh.h:45
auto withUnsafeVertexPointer(F &&f) const noexcept(noexcept(f(std::declval< const VertexData >().data())))
Calls the given functional with an unsafe pointer to the raw vertex storage.
Definition: Mesh.h:349
NormalMatrix< typename DerivedV::Scalar > perVertexNormalMatrix(Eigen::MatrixBase< DerivedV > const &V, Eigen::MatrixBase< DerivedF > const &F)
Returns a Nx3 matrix with per-vertex normals.
Definition: MeshHelpers.h:67
A triangle mesh class.
Definition: BarycentricPoint.h:20
Include file defining the Mesh data type.
LabelVector labelVector(Mesh< T > const &mesh)
Returns a N-vector containing the per vertex labels.
Definition: MeshHelpers.h:56
unsigned int Label
Label type.
Definition: Mesh.h:51
Size triangleCount() const noexcept
Number of triangles.
Definition: Mesh.h:89
FacetMatrix facetMatrix(Mesh< T > const &mesh)
Returns the Mx3 index matrix of the mesh.
Definition: MeshHelpers.h:45
Size vertexCount() const noexcept
Number of vertices.
Definition: Mesh.h:86
auto withUnsafeLabelPointer(F &&f) const noexcept(noexcept(f(LabelData().data())))
Calls the given functional with an unsafe pointer to the raw label storage.
Definition: Mesh.h:395
LaplacianMatrix< typename DerivedV::Scalar > laplacianMatrix(Eigen::MatrixBase< DerivedV > const &V, Eigen::MatrixBase< DerivedF > const &F)
Returns the NxN sparse laplacian matrix (using cotangent weights)
Definition: MeshHelpers.h:87