Skip to content

Commit 8a2107c

Browse files
authored
added is_closed property
checks if the mesh is closed. if its closed, it adds faces from boundary vertices. if its open it does not add these faces to the mesh.
1 parent f379db7 commit 8a2107c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/compas/datastructures/mesh/slice.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ def is_line(self):
7474
@property
7575
def is_polygon(self):
7676
return len(self.intersections) >= 3
77+
78+
@property
79+
def is_closed(self):
80+
return self.mesh.is_closed()
7781

7882
@property
7983
def positive(self):
@@ -90,7 +94,8 @@ def positive(self):
9094
vdict = {key: self.mesh.vertex_coordinates(key) for key in vertices + self.intersections}
9195
fdict = [self.mesh.face_vertices(fkey) for fkey in faces]
9296
mesh = self.meshtype.from_vertices_and_faces(vdict, fdict)
93-
mesh.add_face(mesh.vertices_on_boundary())
97+
if self.is_closed:
98+
mesh.add_face(mesh.vertices_on_boundary())
9499
return mesh
95100

96101
def is_positive(self, key):
@@ -119,7 +124,8 @@ def negative(self):
119124
vdict = {key: self.mesh.vertex_coordinates(key) for key in vertices + self.intersections}
120125
fdict = [self.mesh.face_vertices(fkey) for fkey in faces]
121126
mesh = self.meshtype.from_vertices_and_faces(vdict, fdict)
122-
mesh.add_face(mesh.vertices_on_boundary())
127+
if self.is_closed:
128+
mesh.add_face(mesh.vertices_on_boundary())
123129
return mesh
124130

125131
def is_negative(self, key):

0 commit comments

Comments
 (0)