@@ -85,6 +85,7 @@ def _merged_pec_on_plane(
8585 structure_list : list [Structure ],
8686 center : tuple [float , float ] = [0 , 0 , 0 ],
8787 size : tuple [float , float , float ] = [inf , inf , inf ],
88+ interior_disjoint_geometries : bool = False ,
8889 ) -> list [tuple [Any , Shapely ]]:
8990 """On a 2D plane specified by axis = `normal_axis` and coordinate `coord`, merge geometries made of PEC.
9091
@@ -100,6 +101,8 @@ def _merged_pec_on_plane(
100101 Center of the 2D plane (coordinate along ``axis`` is ignored)
101102 size : Tuple[float, float, float] = [inf, inf, inf]
102103 Size of the 2D plane (size along ``axis`` is ignored)
104+ interior_disjoint_geometries: bool = False
105+ If ``True``, geometries on the plane must not be overlapping.
103106
104107 Returns
105108 -------
@@ -123,7 +126,9 @@ def _merged_pec_on_plane(
123126 PEC if (mat .is_pec or isinstance (mat , LossyMetalMedium )) else mat for mat in medium_list
124127 ]
125128 # merge geometries
126- merged_geos = merging_geometries_on_plane (geometry_list , plane , medium_list )
129+ merged_geos = merging_geometries_on_plane (
130+ geometry_list , plane , medium_list , interior_disjoint_geometries
131+ )
127132
128133 return merged_geos
129134
@@ -133,6 +138,7 @@ def _corners_and_convexity(
133138 coord : float ,
134139 structure_list : list [Structure ],
135140 ravel : bool ,
141+ interior_disjoint_geometries : bool = False ,
136142 ) -> tuple [ArrayFloat2D , ArrayFloat1D ]:
137143 """On a 2D plane specified by axis = `normal_axis` and coordinate `coord`, find out corners of merged
138144 geometries made of PEC.
@@ -148,6 +154,8 @@ def _corners_and_convexity(
148154 List of structures present in simulation.
149155 ravel : bool
150156 Whether to put the resulting corners in a single list or per polygon.
157+ interior_disjoint_geometries: bool = False
158+ If ``True``, geometries made of different materials on the plane must not be overlapping.
151159
152160 Returns
153161 -------
@@ -157,7 +165,10 @@ def _corners_and_convexity(
157165
158166 # merge geometries
159167 merged_geos = self ._merged_pec_on_plane (
160- normal_axis = normal_axis , coord = coord , structure_list = structure_list
168+ normal_axis = normal_axis ,
169+ coord = coord ,
170+ structure_list = structure_list ,
171+ interior_disjoint_geometries = interior_disjoint_geometries ,
161172 )
162173
163174 # corner finder
@@ -183,18 +194,22 @@ def _corners_and_convexity(
183194 )
184195 corner_list .append (corners_xy )
185196 convexity_list .append (corners_convexity )
197+ return self ._ravel_corners_and_convexity (ravel , corner_list , convexity_list )
186198
199+ def _ravel_corners_and_convexity (
200+ self , ravel : bool , corner_list , convexity_list
201+ ) -> tuple [ArrayFloat2D , ArrayFloat1D ]:
202+ """Whether to put the resulting corners in a single list or per polygon."""
187203 if ravel and len (corner_list ) > 0 :
188- corner_list = np .concatenate (corner_list )
189- convexity_list = np .concatenate (convexity_list )
190-
204+ return np .concatenate (corner_list ), np .concatenate (convexity_list )
191205 return corner_list , convexity_list
192206
193207 def corners (
194208 self ,
195209 normal_axis : Axis ,
196210 coord : float ,
197211 structure_list : list [Structure ],
212+ interior_disjoint_geometries : bool = False ,
198213 ) -> ArrayFloat2D :
199214 """On a 2D plane specified by axis = `normal_axis` and coordinate `coord`, find out corners of merged
200215 geometries made of `medium`.
@@ -208,15 +223,20 @@ def corners(
208223 Position of plane along the normal axis.
209224 structure_list : List[Structure]
210225 List of structures present in simulation.
211-
226+ interior_disjoint_geometries: bool = False
227+ If ``True``, geometries made of different materials on the plane must not be overlapping.
212228 Returns
213229 -------
214230 ArrayFloat2D
215231 Corner coordinates.
216232 """
217233
218234 corner_list , _ = self ._corners_and_convexity (
219- normal_axis = normal_axis , coord = coord , structure_list = structure_list , ravel = True
235+ normal_axis = normal_axis ,
236+ coord = coord ,
237+ structure_list = structure_list ,
238+ ravel = True ,
239+ interior_disjoint_geometries = interior_disjoint_geometries ,
220240 )
221241 return corner_list
222242
0 commit comments