From d3e048618a286e748a662539c2c0b69562637caa Mon Sep 17 00:00:00 2001 From: Phil Wang Date: Mon, 8 Jul 2024 13:02:48 -0700 Subject: [PATCH] address https://github.com/lucidrains/meshgpt-pytorch/issues/92#issuecomment-2215070716 again --- meshgpt_pytorch/meshgpt_pytorch.py | 7 +++++-- meshgpt_pytorch/version.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/meshgpt_pytorch/meshgpt_pytorch.py b/meshgpt_pytorch/meshgpt_pytorch.py index 0ff95e5..ab4e330 100644 --- a/meshgpt_pytorch/meshgpt_pytorch.py +++ b/meshgpt_pytorch/meshgpt_pytorch.py @@ -158,14 +158,17 @@ def get_derived_face_features( face_coords: Float['b nf nvf 3'] # 3 or 4 vertices with 3 coordinates ): is_quad = face_coords.shape[-2] == 4 - face_coords_shift = 2 if is_quad else 1 # @sbriseid says quads need to be shifted by 2 # shift face coordinates depending on triangles or quads - shifted_face_coords = torch.roll(face_coords, face_coords_shift, dims = (2,)) + shifted_face_coords = torch.roll(face_coords, 1, dims = (2,)) angles = derive_angle(face_coords, shifted_face_coords) + if is_quad: + # @sbriseid says quads need to be shifted by 2 + shifted_face_coords = torch.roll(shifted_face_coords, 1, dims = (2,)) + edge1, edge2, *_ = (face_coords - shifted_face_coords).unbind(dim = 2) cross_product = torch.cross(edge1, edge2, dim = -1) diff --git a/meshgpt_pytorch/version.py b/meshgpt_pytorch/version.py index c1bbb90..b0ff349 100644 --- a/meshgpt_pytorch/version.py +++ b/meshgpt_pytorch/version.py @@ -1 +1 @@ -__version__ = '1.5.11' +__version__ = '1.5.12'