MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / compute

Method compute

tools/Wires/Attributes/WireEdgeLengthAttribute.cpp:7–17  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5using namespace PyMesh;
6
7void WireEdgeLengthAttribute::compute(const WireNetwork& network) {
8 const size_t num_edges = network.get_num_edges();
9 const MatrixFr& vertices = network.get_vertices();
10 const MatrixIr& edges = network.get_edges();
11
12 m_values.resize(num_edges, 1);
13 for (size_t i=0; i<num_edges; i++) {
14 const auto& edge = edges.row(i);
15 m_values(i,0) = (vertices.row(edge[0]) - vertices.row(edge[1])).norm();
16 }
17}

Callers 1

add_attributeMethod · 0.45

Calls 4

normMethod · 0.80
get_num_edgesMethod · 0.45
get_verticesMethod · 0.45
get_edgesMethod · 0.45

Tested by

no test coverage detected