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

Function loop_is_valid

tools/Wires/Inflator/SimpleInflator.cpp:57–66  ·  view source on GitHub ↗

* Return true iff the projection of loop onto line (v0, v1) is completely * between v0 and v1. */

Source from the content-addressed store, hash-verified

55 * between v0 and v1.
56 */
57 bool loop_is_valid(const MatrixFr& loop,
58 const VectorF& v0, const VectorF& v1) {
59 VectorF dir = v1 - v0;
60 Float dir_sq_len = dir.squaredNorm();
61 if (dir_sq_len == 0.0) {
62 throw RuntimeError("Zero edge encountered.");
63 }
64 VectorF proj = (loop.rowwise() - v0.transpose()) * dir / dir_sq_len;
65 return ((proj.array() > 0.0).all() && (proj.array() < 1.0).all());
66 }
67}
68
69using namespace SimpleInflatorHelper;

Callers 1

generate_end_loopsMethod · 0.85

Calls 1

RuntimeErrorClass · 0.85

Tested by

no test coverage detected