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

Method get_triangle_orientations

tools/MeshUtils/FaceUtils.cpp:74–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74VectorF 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}

Callers 2

print_extended_infoFunction · 0.80

Calls 3

NotImplementedErrorClass · 0.85
exactinitFunction · 0.85
orient2dFunction · 0.85

Tested by

no test coverage detected