Skip to content

Commit 1763380

Browse files
bottlerfacebook-github-bot
authored andcommitted
Scale leaves verts normals unchanged
Summary: There is no need to recalculate normals when scaling a mesh by a constant. We omit doing this for vertex normals. This will make things less confusing when we allow user-specified vertex normals. Face normals also don't need recalculating, but they are calculated at the same time as face areas which do, so it is easiest not to change their behavior here. That is convenient because we are not immediately planning to allow user-specified face normals. Reviewed By: nikhilaravi Differential Revision: D27793476 fbshipit-source-id: 827f1be4bc78bf0391ce3959cce48c4f3ee326fe
1 parent e9f4e0d commit 1763380

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

pytorch3d/structures/meshes.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1336,15 +1336,13 @@ def scale_verts_(self, scale):
13361336
if len(verts) > 0:
13371337
self._verts_padded[i, : verts.shape[0], :] = verts
13381338

1339-
# update face areas and normals and vertex normals
1339+
# update face areas and normals
13401340
# only if the original attributes are computed
13411341
if any(
13421342
v is not None
13431343
for v in [self._faces_areas_packed, self._faces_normals_packed]
13441344
):
13451345
self._compute_face_areas_normals(refresh=True)
1346-
if self._verts_normals_packed is not None:
1347-
self._compute_vertex_normals(refresh=True)
13481346
return self
13491347

13501348
def scale_verts(self, scale):

0 commit comments

Comments
 (0)