Skip to content

Commit

Permalink
address #92 (comment) again
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidrains committed Jul 8, 2024
1 parent b82675d commit d3e0486
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions meshgpt_pytorch/meshgpt_pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion meshgpt_pytorch/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.5.11'
__version__ = '1.5.12'

0 comments on commit d3e0486

Please sign in to comment.