From 17633808d88facb4a1016b6b81bf681dfd0fd657 Mon Sep 17 00:00:00 2001 From: Jeremy Reizenstein Date: Tue, 4 May 2021 05:35:24 -0700 Subject: [PATCH] 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 --- pytorch3d/structures/meshes.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pytorch3d/structures/meshes.py b/pytorch3d/structures/meshes.py index b5fc1baf..7998aa06 100644 --- a/pytorch3d/structures/meshes.py +++ b/pytorch3d/structures/meshes.py @@ -1336,15 +1336,13 @@ class Meshes(object): 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):