16#include <lagrange/Edge.h>
17#include <lagrange/Mesh.h>
18#include <lagrange/MeshTrait.h>
19#include <lagrange/attributes/eval_as_attribute.h>
20#include <lagrange/legacy/inline.h>
30template <
typename MeshType>
33 static_assert(MeshTrait<MeshType>::is_mesh(),
"Input type is not Mesh");
35 using Index =
typename MeshType::Index;
37 mesh.initialize_edge_data();
39 const auto& vertices = mesh.get_vertices();
41 eval_as_edge_attribute_new(mesh,
"length", [&](Index e_idx) {
42 auto v = mesh.get_edge_vertices(e_idx);
43 auto p0 = vertices.row(v[0]);
44 auto p1 = vertices.row(v[1]);
45 return (p0 - p1).norm();
AttributeId compute_edge_lengths(SurfaceMesh< Scalar, Index > &mesh, const EdgeLengthOptions &options={})
Computes edge lengths attribute.
Definition: compute_edge_lengths.cpp:28
Main namespace for Lagrange.
Definition: AABBIGL.h:30