Skip to content

Commit

Permalink
Scale leaves verts normals unchanged
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bottler authored and facebook-github-bot committed May 4, 2021
1 parent e9f4e0d commit 1763380
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions pytorch3d/structures/meshes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1336,15 +1336,13 @@ def scale_verts_(self, scale):
if len(verts) > 0:
self._verts_padded[i, : verts.shape[0], :] = verts

# update face areas and normals and vertex normals
# update face areas and normals
# only if the original attributes are computed
if any(
v is not None
for v in [self._faces_areas_packed, self._faces_normals_packed]
):
self._compute_face_areas_normals(refresh=True)
if self._verts_normals_packed is not None:
self._compute_vertex_normals(refresh=True)
return self

def scale_verts(self, scale):
Expand Down

0 comments on commit 1763380

Please sign in to comment.