Lagrange
views.h
1/*
2 * Copyright 2022 Adobe. All rights reserved.
3 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License. You may obtain a copy
5 * of the License at http://www.apache.org/licenses/LICENSE-2.0
6 *
7 * Unless required by applicable law or agreed to in writing, software distributed under
8 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9 * OF ANY KIND, either express or implied. See the License for the specific language
10 * governing permissions and limitations under the License.
11 */
12#pragma once
13
14#include <lagrange/SurfaceMesh.h>
15
16#include <Eigen/Core>
17
18namespace lagrange {
19
59
64
66template <typename Scalar>
67using RowMatrix = Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>;
68
70template <typename Scalar>
71using RowMatrixView = Eigen::Map<RowMatrix<Scalar>, Eigen::Unaligned>;
72
74template <typename Scalar>
75using ConstRowMatrixView = const Eigen::Map<const RowMatrix<Scalar>, Eigen::Unaligned>;
76
78template <typename Scalar>
79using Vector = Eigen::Matrix<Scalar, Eigen::Dynamic, 1>;
80
82template <typename Scalar>
83using VectorView = Eigen::Map<Vector<Scalar>, Eigen::Unaligned>;
84
86template <typename Scalar>
87using ConstVectorView = const Eigen::Map<const Vector<Scalar>, Eigen::Unaligned>;
88
94
104template <typename ValueType>
106
116template <typename ValueType>
118
129template <typename ValueType>
131
142template <typename ValueType>
144
158template <typename ValueType>
160
174template <typename ValueType>
175ConstRowMatrixView<ValueType> reshaped_view(const Attribute<ValueType>& attribute, size_t num_cols);
176
182
195template <typename ValueType, typename Scalar, typename Index>
198 std::string_view name);
199
212template <typename ValueType, typename Scalar, typename Index>
215 AttributeId id);
216
229template <typename ValueType, typename Scalar, typename Index>
231 const SurfaceMesh<Scalar, Index>& mesh,
232 std::string_view name);
233
246template <typename ValueType, typename Scalar, typename Index>
248 const SurfaceMesh<Scalar, Index>& mesh,
249 AttributeId id);
250
264template <typename ValueType, typename Scalar, typename Index>
267 std::string_view name);
268
282template <typename ValueType, typename Scalar, typename Index>
285 AttributeId id);
286
300template <typename ValueType, typename Scalar, typename Index>
302 const SurfaceMesh<Scalar, Index>& mesh,
303 std::string_view name);
304
318template <typename ValueType, typename Scalar, typename Index>
320 const SurfaceMesh<Scalar, Index>& mesh,
321 AttributeId id);
322
328
339template <typename Scalar, typename Index>
341
352template <typename Scalar, typename Index>
354
366template <typename Scalar, typename Index>
368
380template <typename Scalar, typename Index>
382
385
386} // namespace lagrange
uint32_t AttributeId
Identified to be used to access an attribute.
Definition: AttributeFwd.h:73
Eigen::Map< RowMatrix< Scalar >, Eigen::Unaligned > RowMatrixView
Type alias for row-major matrix views.
Definition: views.h:71
ConstRowMatrixView< ValueType > matrix_view(const Attribute< ValueType > &attribute)
Returns a read-only view of a given attribute in the form of an Eigen matrix.
Definition: views.cpp:35
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.
Definition: views.cpp:96
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > Vector
Type alias for one-dimensional column Eigen vectors.
Definition: views.h:79
VectorView< ValueType > vector_ref(Attribute< ValueType > &attribute)
Returns a writable view of a scalar attribute in the form of an Eigen vector.
Definition: views.cpp:44
ConstVectorView< ValueType > vector_view(const Attribute< ValueType > &attribute)
Returns a read-only view of a scalar attribute in the form of an Eigen vector.
Definition: views.cpp:51
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
Eigen::Map< Vector< Scalar >, Eigen::Unaligned > VectorView
Type alias for row-major vector view.
Definition: views.h:83
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.
Definition: views.cpp:88
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.
Definition: views.cpp:104
Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > RowMatrix
Type alias for row-major Eigen matrices.
Definition: views.h:67
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
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 pr...
Definition: views.cpp:71
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
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 pre...
Definition: views.cpp:58
const Eigen::Map< const Vector< Scalar >, Eigen::Unaligned > ConstVectorView
Type alias for row-major const vector view.
Definition: views.h:87
const Eigen::Map< const RowMatrix< Scalar >, Eigen::Unaligned > ConstRowMatrixView
Type alias for row-major const matrix view.
Definition: views.h:75
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.
Definition: views.cpp:110
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
RowMatrixView< ValueType > matrix_ref(Attribute< ValueType > &attribute)
Returns a writable view of a given attribute in the form of an Eigen matrix.
Definition: views.cpp:26
Main namespace for Lagrange.
Definition: AABBIGL.h:30