* Return true iff the projection of loop onto line (v0, v1) is completely * between v0 and v1. */
| 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 | |
| 69 | using namespace SimpleInflatorHelper; |
no test coverage detected