| 72 | } |
| 73 | |
| 74 | VectorF FaceUtils::get_triangle_orientations( |
| 75 | const MatrixFr& vertices, const MatrixIr& faces) { |
| 76 | const size_t num_faces = faces.rows(); |
| 77 | const size_t dim = vertices.cols(); |
| 78 | if (dim != 2) { |
| 79 | throw NotImplementedError( |
| 80 | "Triangle orientation is only well-defined in 2D"); |
| 81 | } |
| 82 | |
| 83 | exactinit(); |
| 84 | |
| 85 | VectorF results(num_faces); |
| 86 | for (size_t i=0; i<num_faces; i++) { |
| 87 | const auto& f = faces.row(i); |
| 88 | double v0_xy[2] = {vertices(f[0], 0), vertices(f[0], 1)}; |
| 89 | double v1_xy[2] = {vertices(f[1], 0), vertices(f[1], 1)}; |
| 90 | double v2_xy[2] = {vertices(f[2], 0), vertices(f[2], 1)}; |
| 91 | results[i] = orient2d(v0_xy, v1_xy, v2_xy); |
| 92 | } |
| 93 | return results; |
| 94 | } |
no test coverage detected