View mesh attributes as Eigen matrices.
More...
|
|
template<typename Scalar> |
| using | RowMatrix = Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> |
| | Type alias for row-major Eigen matrices.
|
| |
|
template<typename Scalar> |
| using | RowMatrixView = Eigen::Map<RowMatrix<Scalar>, Eigen::Unaligned> |
| | Type alias for row-major matrix views.
|
| |
|
template<typename Scalar> |
| using | ConstRowMatrixView = const Eigen::Map<const RowMatrix<Scalar>, Eigen::Unaligned> |
| | Type alias for row-major const matrix view.
|
| |
|
template<typename Scalar> |
| using | Vector = Eigen::Matrix<Scalar, Eigen::Dynamic, 1> |
| | Type alias for one-dimensional column Eigen vectors.
|
| |
|
template<typename Scalar> |
| using | VectorView = Eigen::Map<Vector<Scalar>, Eigen::Unaligned> |
| | Type alias for row-major vector view.
|
| |
|
template<typename Scalar> |
| using | ConstVectorView = const Eigen::Map<const Vector<Scalar>, Eigen::Unaligned> |
| | Type alias for row-major const vector view.
|
| |
|
| template<typename ValueType> |
| RowMatrixView< ValueType > | matrix_ref (Attribute< ValueType > &attribute) |
| | Returns a writable view of a given attribute in the form of an Eigen matrix.
|
| |
| template<typename ValueType> |
| ConstRowMatrixView< ValueType > | matrix_view (const Attribute< ValueType > &attribute) |
| | Returns a read-only view of a given attribute in the form of an Eigen matrix.
|
| |
| template<typename ValueType> |
| VectorView< ValueType > | vector_ref (Attribute< ValueType > &attribute) |
| | Returns a writable view of a scalar attribute in the form of an Eigen vector.
|
| |
| template<typename ValueType> |
| ConstVectorView< ValueType > | vector_view (const Attribute< ValueType > &attribute) |
| | Returns a read-only view of a scalar attribute in the form of an Eigen vector.
|
| |
| template<typename ValueType> |
| RowMatrixView< ValueType > | reshaped_ref (Attribute< ValueType > &attribute, size_t num_cols) |
| | Returns a writable view of a given single-channel attribute in the form of an Eigen matrix with a prescribed number of columns.
|
| |
| template<typename ValueType> |
| ConstRowMatrixView< ValueType > | reshaped_view (const Attribute< ValueType > &attribute, size_t num_cols) |
| | Returns a read-only view of a given single-channel attribute in the form of an Eigen matrix with a prescribed number of columns.
|
| |
|
| template<typename ValueType, typename Scalar, typename Index> |
| RowMatrixView< ValueType > | attribute_matrix_ref (SurfaceMesh< Scalar, Index > &mesh, std::string_view name) |
| | Returns a writable view of a mesh attribute in the form of an Eigen matrix.
|
| |
| template<typename ValueType, typename Scalar, typename Index> |
| RowMatrixView< ValueType > | attribute_matrix_ref (SurfaceMesh< Scalar, Index > &mesh, AttributeId id) |
| | Returns a writable view of a mesh attribute in the form of an Eigen matrix.
|
| |
| template<typename ValueType, typename Scalar, typename Index> |
| ConstRowMatrixView< ValueType > | attribute_matrix_view (const SurfaceMesh< Scalar, Index > &mesh, std::string_view name) |
| | Returns a read-only view of a mesh attribute in the form of an Eigen matrix.
|
| |
| template<typename ValueType, typename Scalar, typename Index> |
| ConstRowMatrixView< ValueType > | attribute_matrix_view (const SurfaceMesh< Scalar, Index > &mesh, AttributeId id) |
| | Returns a read-only view of a mesh attribute in the form of an Eigen matrix.
|
| |
| template<typename ValueType, typename Scalar, typename Index> |
| VectorView< ValueType > | attribute_vector_ref (SurfaceMesh< Scalar, Index > &mesh, std::string_view name) |
| | Returns a writable view of a mesh attribute in the form of an Eigen vector.
|
| |
| template<typename ValueType, typename Scalar, typename Index> |
| VectorView< ValueType > | attribute_vector_ref (SurfaceMesh< Scalar, Index > &mesh, AttributeId id) |
| | Returns a writable view of a mesh attribute in the form of an Eigen vector.
|
| |
| template<typename ValueType, typename Scalar, typename Index> |
| ConstVectorView< ValueType > | attribute_vector_view (const SurfaceMesh< Scalar, Index > &mesh, std::string_view name) |
| | Returns a read-only view of a mesh attribute in the form of an Eigen vector.
|
| |
| template<typename ValueType, typename Scalar, typename Index> |
| ConstVectorView< ValueType > | attribute_vector_view (const SurfaceMesh< Scalar, Index > &mesh, AttributeId id) |
| | Returns a read-only view of a mesh attribute in the form of an Eigen vector.
|
| |
View mesh attributes as Eigen matrices.
Mesh attributes such as positions and facet indices can be views as Eigen matrices. Specifically, we provide read-only views as Eigen::Map<const ...>:
#include <lagrange/SurfaceMesh.h>
#include <lagrange/views.h>
#include <igl/massmatrix.h>
Eigen::SparseMatrix<Scalar> M;
igl::massmatrix(V_view, F_view, igl::MASSMATRIX_TYPE_VORONOI, M);
A general purpose polygonal mesh class.
Definition SurfaceMesh.h:66
ConstRowMatrixView< Scalar > vertex_view(const SurfaceMesh< Scalar, Index > &mesh)
Returns a read-only view of the mesh vertices in the form of an Eigen matrix.
Definition views.cpp:156
ConstRowMatrixView< Index > facet_view(const SurfaceMesh< Scalar, Index > &mesh)
Returns a read-only view of a mesh facets in the form of an Eigen matrix.
Definition views.cpp:170
Writable reference are also available:
V_ref.rowwise() -= V_ref.colwise().mean();
RowMatrixView< Scalar > vertex_ref(SurfaceMesh< Scalar, Index > &mesh)
Returns a writable view of the mesh vertices in the form of an Eigen matrix.
Definition views.cpp:150
RowMatrixView< Index > facet_ref(SurfaceMesh< Scalar, Index > &mesh)
Returns a writable view of a mesh facets in the form of an Eigen matrix.
Definition views.cpp:162
◆ matrix_ref()
template<typename ValueType>
#include <lagrange/views.h>
Returns a writable view of a given attribute in the form of an Eigen matrix.
- Parameters
-
| [in] | attribute | Attribute to view. |
- Template Parameters
-
| ValueType | Attribute scalar type. |
- Returns
- An Eigen::Map wrapping the attribute data.
◆ matrix_view()
template<typename ValueType>
#include <lagrange/views.h>
Returns a read-only view of a given attribute in the form of an Eigen matrix.
- Parameters
-
| [in] | attribute | Attribute to view. |
- Template Parameters
-
| ValueType | Attribute scalar type. |
- Returns
- An Eigen::Map wrapping the attribute data.
◆ vector_ref()
template<typename ValueType>
#include <lagrange/views.h>
Returns a writable view of a scalar attribute in the form of an Eigen vector.
The attribute must have exactly one channel.
- Parameters
-
| [in] | attribute | Attribute to view. |
- Template Parameters
-
| ValueType | Attribute scalar type. |
- Returns
- An Eigen::Map wrapping the attribute data.
◆ vector_view()
template<typename ValueType>
#include <lagrange/views.h>
Returns a read-only view of a scalar attribute in the form of an Eigen vector.
The attribute must have exactly one channel.
- Parameters
-
| [in] | attribute | Attribute to view. |
- Template Parameters
-
| ValueType | Attribute scalar type. |
- Returns
- An Eigen::Map wrapping the attribute data.
◆ reshaped_ref()
template<typename ValueType>
#include <lagrange/views.h>
Returns a writable view of a given single-channel attribute in the form of an Eigen matrix with a prescribed number of columns.
This is useful to view arbitrary corner attributes as 2D matrices for regular meshes.
- Parameters
-
| [in] | attribute | Attribute to view. |
| [in] | num_cols | Number of columns to use. It must divide the number of elements of the prescribed attribute. |
- Template Parameters
-
| ValueType | Attribute scalar type. |
- Returns
- An Eigen::Map wrapping the attribute data.
◆ reshaped_view()
template<typename ValueType>
#include <lagrange/views.h>
Returns a read-only view of a given single-channel attribute in the form of an Eigen matrix with a prescribed number of columns.
This is useful to view arbitrary corner attributes as 2D matrices for regular meshes.
- Parameters
-
| [in] | attribute | Attribute to view. |
| [in] | num_cols | Number of columns to use. It must divide the number of elements of the prescribed attribute. |
- Template Parameters
-
| ValueType | Attribute scalar type. |
- Returns
- An Eigen::Map wrapping the attribute data.
◆ attribute_matrix_ref() [1/2]
template<typename ValueType, typename
Scalar, typename Index>
#include <lagrange/views.h>
Returns a writable view of a mesh attribute in the form of an Eigen matrix.
- Parameters
-
| [in] | mesh | Mesh whose attribute to view. |
| [in] | name | Name of the mesh attribute to view. |
- Template Parameters
-
| ValueType | Attribute scalar type. |
| Scalar | Mesh scalar type. |
| Index | Mesh index type. |
- Returns
- An Eigen::Map wrapping the attribute data.
◆ attribute_matrix_ref() [2/2]
template<typename ValueType, typename
Scalar, typename Index>
#include <lagrange/views.h>
Returns a writable view of a mesh attribute in the form of an Eigen matrix.
- Parameters
-
| [in] | mesh | Mesh whose attribute to view. |
| [in] | id | Id of the mesh attribute to view. |
- Template Parameters
-
| ValueType | Attribute scalar type. |
| Scalar | Mesh scalar type. |
| Index | Mesh index type. |
- Returns
- An Eigen::Map wrapping the attribute data.
◆ attribute_matrix_view() [1/2]
template<typename ValueType, typename
Scalar, typename Index>
#include <lagrange/views.h>
Returns a read-only view of a mesh attribute in the form of an Eigen matrix.
- Parameters
-
| [in] | mesh | Mesh whose attribute to view. |
| [in] | name | Name of the mesh attribute to view. |
- Template Parameters
-
| ValueType | Attribute scalar type. |
| Scalar | Mesh scalar type. |
| Index | Mesh index type. |
- Returns
- An Eigen::Map wrapping the attribute data.
◆ attribute_matrix_view() [2/2]
template<typename ValueType, typename
Scalar, typename Index>
#include <lagrange/views.h>
Returns a read-only view of a mesh attribute in the form of an Eigen matrix.
- Parameters
-
| [in] | mesh | Mesh whose attribute to view. |
| [in] | id | Id of the mesh attribute to view. |
- Template Parameters
-
| ValueType | Attribute scalar type. |
| Scalar | Mesh scalar type. |
| Index | Mesh index type. |
- Returns
- An Eigen::Map wrapping the attribute data.
◆ attribute_vector_ref() [1/2]
template<typename ValueType, typename
Scalar, typename Index>
#include <lagrange/views.h>
Returns a writable view of a mesh attribute in the form of an Eigen vector.
The attribute must have exactly one channel.
- Parameters
-
| [in] | mesh | Mesh whose attribute to view. |
| [in] | name | Name of the mesh attribute to view. |
- Template Parameters
-
| ValueType | Attribute scalar type. |
| Scalar | Mesh scalar type. |
| Index | Mesh index type. |
- Returns
- An Eigen::Map wrapping the attribute data.
◆ attribute_vector_ref() [2/2]
template<typename ValueType, typename
Scalar, typename Index>
#include <lagrange/views.h>
Returns a writable view of a mesh attribute in the form of an Eigen vector.
The attribute must have exactly one channel.
- Parameters
-
| [in] | mesh | Mesh whose attribute to view. |
| [in] | id | Id of the mesh attribute to view. |
- Template Parameters
-
| ValueType | Attribute scalar type. |
| Scalar | Mesh scalar type. |
| Index | Mesh index type. |
- Returns
- An Eigen::Map wrapping the attribute data.
◆ attribute_vector_view() [1/2]
template<typename ValueType, typename
Scalar, typename Index>
#include <lagrange/views.h>
Returns a read-only view of a mesh attribute in the form of an Eigen vector.
The attribute must have exactly one channel.
- Parameters
-
| [in] | mesh | Mesh whose attribute to view. |
| [in] | name | Name of the mesh attribute to view. |
- Template Parameters
-
| ValueType | Attribute scalar type. |
| Scalar | Mesh scalar type. |
| Index | Mesh index type. |
- Returns
- An Eigen::Map wrapping the attribute data.
◆ attribute_vector_view() [2/2]
template<typename ValueType, typename
Scalar, typename Index>
#include <lagrange/views.h>
Returns a read-only view of a mesh attribute in the form of an Eigen vector.
The attribute must have exactly one channel.
- Parameters
-
| [in] | mesh | Mesh whose attribute to view. |
| [in] | id | Id of the mesh attribute to view. |
- Template Parameters
-
| ValueType | Attribute scalar type. |
| Scalar | Mesh scalar type. |
| Index | Mesh index type. |
- Returns
- An Eigen::Map wrapping the attribute data.
◆ vertex_ref()
template<typename
Scalar, typename Index>
#include <lagrange/views.h>
Returns a writable view of the mesh vertices in the form of an Eigen matrix.
- Parameters
-
| [in] | mesh | Mesh whose vertices to view. |
- Template Parameters
-
| Scalar | Mesh scalar type. |
| Index | Mesh index type. |
- Returns
- An Eigen::Map wrapping the attribute data.
◆ vertex_view()
template<typename
Scalar, typename Index>
#include <lagrange/views.h>
Returns a read-only view of the mesh vertices in the form of an Eigen matrix.
- Parameters
-
| [in] | mesh | Mesh whose vertices to view. |
- Template Parameters
-
| Scalar | Mesh scalar type. |
| Index | Mesh index type. |
- Returns
- An Eigen::Map wrapping the attribute data.
◆ facet_ref()
template<typename
Scalar, typename Index>
#include <lagrange/views.h>
Returns a writable view of a mesh facets in the form of an Eigen matrix.
This function only works for regular meshes. If the mesh does not have a fixed facet size, an exception is thrown.
- Parameters
-
| [in] | mesh | Mesh whose facets to view. |
- Template Parameters
-
| Scalar | Mesh scalar type. |
| Index | Mesh index type. |
- Returns
- An Eigen::Map wrapping the attribute data.
◆ facet_view()
template<typename
Scalar, typename Index>
#include <lagrange/views.h>
Returns a read-only view of a mesh facets in the form of an Eigen matrix.
This function only works for regular meshes. If the mesh does not have a fixed facet size, an exception is thrown.
- Parameters
-
| [in] | mesh | Mesh whose facets to view. |
- Template Parameters
-
| Scalar | Mesh scalar type. |
| Index | Mesh index type. |
- Returns
- An Eigen::Map wrapping the attribute data.