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

Method validate_end_loop_offset

tools/Wires/Inflator/SimpleInflator.cpp:298–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296}
297
298void SimpleInflator::validate_end_loop_offset() const {
299 const size_t num_edges = m_wire_network->get_num_edges();
300 const MatrixIr& edges = m_wire_network->get_edges();
301 const auto& edge_lengths = m_wire_network->get_attribute("edge_length");
302
303 for (size_t i=0; i<num_edges; i++) {
304 const Vector2I edge = edges.row(i);
305 Float edge_len = edge_lengths(i, 0);
306 Float v0_offset = m_end_loop_offsets[edge[0]];
307 Float v1_offset = m_end_loop_offsets[edge[1]];
308 if (edge_len < v0_offset + v1_offset + EPSILON) {
309 std::stringstream err_msg;
310 err_msg << "Edge " << i << " is too short: len=" << edge_len <<
311 std::endl;
312 err_msg << "Its length needs to be at least "
313 << v0_offset + v1_offset + EPSILON
314 << " to ensure inflation is self-intersection free";
315 if (m_self_intersection_is_fatal) {
316 throw RuntimeError(err_msg.str());
317 } else {
318 std::cerr << err_msg.str() << std::endl;
319 }
320 }
321 }
322}
323
324MatrixFr SimpleInflator::get_edge_thickness() const {
325 const size_t num_edges = m_wire_network->get_num_edges();

Callers

nothing calls this directly

Calls 5

RuntimeErrorClass · 0.85
get_num_edgesMethod · 0.45
get_edgesMethod · 0.45
get_attributeMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected