8 template <
typename Mat>
11 const std::string& name,
16 mesh.template register_attribute<typename Mat::Scalar>(name, type, data.cols());
19 auto thandle = handle.
as<
typename Mat::Scalar>();
22 const auto tuples = mesh.
get_all(type);
23 for (
size_t i = 0; i < tuples.size(); ++i) {
24 const auto& t = tuples[i];
25 accessor.vector_attribute(t) = data.row(i).transpose();
std::vector< Tuple > get_all(PrimitiveType type) const
Generate a vector of Tuples from global vertex/edge/triangle/tetrahedron index.
attribute::Accessor< T, Mesh, D > create_accessor(const attribute::MeshAttributeHandle &handle)
A CachingAccessor that uses tuples for accessing attributes instead of indices.
auto as() const -> const held_handle_type< held_type_from_primitive< T >()> &
Eigen::Vector3d compute_face_normal(const TriMesh &m, const attribute::Accessor< double > &pos, const Tuple &f)
compute the normalized face normal based on the vertex positions
Eigen::Vector3d compute_face_normal_area_weighted(const TriMesh &m, const attribute::Accessor< double > &pos, const Tuple &f)
compute area vector of face
Eigen::Vector3d compute_vertex_normal(const TriMesh &m, const attribute::Accessor< double > &pos, const Tuple &v)
compute the normalized vertex normal from the incident area weighted face normals
attribute::MeshAttributeHandle set_matrix_attribute(const Mat &data, const std::string &name, const PrimitiveType &type, Mesh &mesh)
Vector< double, 3 > Vector3d