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

Function reorientate_triangles

tools/Wires/Inflator/PeriodicBoundaryRemesher.cpp:50–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48 }
49
50 void reorientate_triangles(const MatrixFr& vertices, MatrixIr& faces,
51 const VectorF& n) {
52 assert(vertices.cols() == 3);
53 assert(faces.cols() == 3);
54
55 const VectorI& f = faces.row(0);
56 const Vector3F& v0 = vertices.row(f[0]);
57 const Vector3F& v1 = vertices.row(f[1]);
58 const Vector3F& v2 = vertices.row(f[2]);
59
60 Float projected_area = (v1-v0).cross(v2-v0).dot(n);
61 if (projected_area < 0) {
62 faces.col(2).swap(faces.col(1));
63 }
64 }
65
66 void save_mesh(const std::string& filename,
67 const MatrixFr& vertices, const MatrixIr& faces, VectorF debug) {

Callers 1

triangulate_bd_loopsMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected