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

Method updateVertexNormals

SPlisHSPlasH/TriangleMesh.cpp:80–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80void SPH::TriangleMesh::updateVertexNormals()
81{
82 m_vertexNormals.resize(numVertices());
83
84
85 for (unsigned int i = 0; i < numVertices(); i++)
86 {
87 m_vertexNormals[i].setZero();
88 }
89
90 for (unsigned int i = 0u; i < numFaces(); i++)
91 {
92 const Vector3r &n = m_normals[i];
93 m_vertexNormals[m_indices[3*i]] += n;
94 m_vertexNormals[m_indices[3*i + 1]] += n;
95 m_vertexNormals[m_indices[3*i + 2]] += n;
96 }
97
98 for (unsigned int i = 0; i < numVertices(); i++)
99 {
100 m_vertexNormals[i].normalize();
101 }
102}
103
104void TriangleMesh::updateMeshTransformation(const Vector3r& x, const Matrix3r& R)
105{

Callers 3

loadObjMethod · 0.80
readRigidBodyDataMethod · 0.80

Calls 3

resizeMethod · 0.45
setZeroMethod · 0.45
normalizeMethod · 0.45

Tested by

no test coverage detected