MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / updateNormals

Method updateNormals

SPlisHSPlasH/TriangleMesh.cpp:56–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56void SPH::TriangleMesh::updateNormals()
57{
58 m_normals.resize(numFaces());
59
60 #pragma omp parallel default(shared)
61 {
62 #pragma omp for schedule(static)
63 for (int i = 0; i < (int)numFaces(); i++)
64 {
65 // Get first three points of face
66 const Vector3r &a = m_x[m_indices[3 * i]];
67 const Vector3r &b = m_x[m_indices[3 * i + 1]];
68 const Vector3r &c = m_x[m_indices[3 * i + 2]];
69
70 // Create normal
71 Vector3r v1 = b - a;
72 Vector3r v2 = c - a;
73
74 m_normals[i] = v1.cross(v2);
75 m_normals[i].normalize();
76 }
77 }
78}
79
80void SPH::TriangleMesh::updateVertexNormals()
81{

Callers 3

loadObjMethod · 0.80
readRigidBodyDataMethod · 0.80

Calls 3

resizeMethod · 0.45
crossMethod · 0.45
normalizeMethod · 0.45

Tested by

no test coverage detected