Skip to content

Commit

Permalink
fix(mesh): Force the regeneration of normals after joining
Browse files Browse the repository at this point in the history
I know that I originally put this code here to save time but it is definitely buggy and, in the grand scheme of things, it's more important that the joining of meshes be reliable than having to wait a few extra seconds at most to regenerate normal.
  • Loading branch information
chriswmackey committed Apr 1, 2021
1 parent 5d0820e commit 98cc25c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 10 deletions.
8 changes: 0 additions & 8 deletions ladybug_geometry/geometry3d/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,14 +382,6 @@ def join_meshes(meshes):
new_mesh = Mesh3D(verts, faces, colors)
else:
new_mesh = Mesh3D(verts, faces)

# attempt to transfer the centroids and normals
if all(msh._face_centroids is not None for msh in meshes):
new_mesh._face_centroids = tuple(pt for msh in meshes for pt in msh)
if all(msh._face_normals is not None for msh in meshes):
new_mesh._face_normals = tuple(v for msh in meshes for v in msh.face_normals)
if all(msh._face_areas is not None for msh in meshes):
new_mesh._face_areas = tuple(a for msh in meshes for a in msh.face_areas)
return new_mesh

def _calculate_min_max(self):
Expand Down
2 changes: 0 additions & 2 deletions tests/mesh3d_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,5 +469,3 @@ def test_join_meshes():
assert isinstance(joined_mesh, Mesh3D)
assert len(joined_mesh.faces) == 2
assert len(joined_mesh.vertices) == 8
assert joined_mesh._face_centroids is not None
assert joined_mesh._face_normals is not None

0 comments on commit 98cc25c

Please sign in to comment.