22
22
from ._FM_utils import (
23
23
_get_node_centered_data ,
24
24
_plot_map ,
25
- BoundaryPolylines ,
25
+ BoundaryPolygons ,
26
26
Polygon ,
27
27
_set_xy_label_by_projection , # TODO remove
28
28
_to_polygons , # TODO remove
@@ -843,9 +843,9 @@ def get_element_area(self) -> np.ndarray:
843
843
return np .abs (area )
844
844
845
845
@cached_property
846
- def boundary_polylines (self ) -> BoundaryPolylines :
846
+ def boundary_polylines (self ) -> BoundaryPolygons :
847
847
"""Lists of closed polylines defining domain outline."""
848
- return self ._get_boundary_polylines ()
848
+ return self ._get_boundary_polygons ()
849
849
850
850
def contains (self , points : np .ndarray ) -> np .ndarray :
851
851
"""Test if a list of points are contained by mesh.
@@ -861,19 +861,18 @@ def contains(self, points: np.ndarray) -> np.ndarray:
861
861
True for points inside, False otherwise
862
862
863
863
"""
864
-
865
864
points = np .atleast_2d (points )
866
865
867
866
return self .boundary_polylines .contains (points )
868
867
869
868
def __contains__ (self , pt : np .ndarray ) -> bool :
870
869
return self .contains (pt )[0 ]
871
870
872
- def _get_boundary_polylines_uncategorized (self ) -> list [list [np .int64 ]]:
873
- """Construct closed polylines for all boundary faces."""
871
+ def _get_boundary_polygons_uncategorized (self ) -> list [list [np .int64 ]]:
872
+ """Construct closed polygons for all boundary faces."""
874
873
boundary_faces = self ._get_boundary_faces ()
875
874
face_remains = boundary_faces .copy ()
876
- polylines = []
875
+ polygons = []
877
876
while face_remains .shape [0 ] > 1 :
878
877
n0 = face_remains [:, 0 ]
879
878
n1 = face_remains [:, 1 ]
@@ -892,28 +891,26 @@ def _get_boundary_polylines_uncategorized(self) -> list[list[np.int64]]:
892
891
break
893
892
894
893
face_remains = np .delete (face_remains , index_to_delete , axis = 0 )
895
- polylines .append (polyline )
896
- return polylines
894
+ polygons .append (polyline )
895
+ return polygons
897
896
898
- def _get_boundary_polylines (self ) -> BoundaryPolylines :
897
+ def _get_boundary_polygons (self ) -> BoundaryPolygons :
899
898
"""Get boundary polylines and categorize as inner or outer by assessing the signed area."""
900
- polylines = self ._get_boundary_polylines_uncategorized ()
899
+ polygons = self ._get_boundary_polygons_uncategorized ()
901
900
902
901
interiors = []
903
902
exteriors = []
904
903
905
- for polyline in polylines :
906
- # xy = self.node_coordinates[polyline, :2]
907
-
908
- poly_line = np .asarray (polyline )
909
- xy = self .node_coordinates [poly_line , 0 :2 ]
904
+ for polygon in polygons :
905
+ polygon_np = np .asarray (polygon )
906
+ xy = self .node_coordinates [polygon_np , 0 :2 ]
910
907
poly = Polygon (xy )
911
908
if poly .area > 0 :
912
909
exteriors .append (poly )
913
910
else :
914
911
interiors .append (poly )
915
912
916
- return BoundaryPolylines (exteriors = exteriors , interiors = interiors )
913
+ return BoundaryPolygons (exteriors = exteriors , interiors = interiors )
917
914
918
915
def _get_boundary_faces (self ) -> np .ndarray :
919
916
"""Construct list of faces."""
0 commit comments