Skip to content

Commit bfc46eb

Browse files
authored
Fix calculating geometric normals (#270)
1 parent b267b97 commit bfc46eb

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

examples/viewer/viewer.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ static void CalcNormal(float N[3], float v0[3], float v1[3], float v2[3]) {
181181
v20[1] = v2[1] - v0[1];
182182
v20[2] = v2[2] - v0[2];
183183

184-
N[0] = v20[1] * v10[2] - v20[2] * v10[1];
185-
N[1] = v20[2] * v10[0] - v20[0] * v10[2];
186-
N[2] = v20[0] * v10[1] - v20[1] * v10[0];
184+
N[0] = v10[1] * v20[2] - v10[2] * v20[1];
185+
N[1] = v10[2] * v20[0] - v10[0] * v20[2];
186+
N[2] = v10[0] * v20[1] - v10[1] * v20[0];
187187

188188
float len2 = N[0] * N[0] + N[1] * N[1] + N[2] * N[2];
189189
if (len2 > 0.0f) {

0 commit comments

Comments
 (0)