Skip to content

Commit

Permalink
Merge pull request #178 from felicio93/endtoend_update
Browse files Browse the repository at this point in the history
updated utils, remove buffer mesh slivers
  • Loading branch information
felicio93 authored Jan 21, 2025
2 parents 695aefd + 5639acd commit a40b65a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions ocsmesh/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2808,12 +2808,13 @@ def create_mesh_from_mesh_diff(domain: Union[jigsaw_msh_t,
).union_all()
)
gdf_full_buffer = gpd.GeoDataFrame(
geometry = [poly_buffer],crs=crs)
geometry = [poly_buffer],crs=crs).explode()

gap_poly = domain.union_all().\
difference(mesh_1_poly).\
difference(mesh_2_poly)


if hfun_mesh is not None:
hfun_mesh = clip_mesh_by_shape(hfun_mesh,gap_poly,fit_inside=True)
boundary = np.unique(get_boundary_edges(hfun_mesh))
Expand All @@ -2832,11 +2833,20 @@ def create_mesh_from_mesh_diff(domain: Union[jigsaw_msh_t,
msht_buffer = triangulate_polygon(gdf_full_buffer,
aux_pts=hfun_nodes)
else:
area_threshold = 1.0e-15 #to remove slivers
gdf_full_buffer['area'] = gdf_full_buffer.geometry.area
gdf_full_buffer = gdf_full_buffer[gdf_full_buffer['area'] >= area_threshold]
msht_buffer = triangulate_polygon_s(gdf_full_buffer,
min_int_ang=min_int_ang,
aux_pts=hfun_nodes)
msht_buffer.crs = crs
msht_buffer=clip_mesh_by_shape(msht_buffer,gap_poly.buffer(buffer_domain))
gap_poly = gpd.GeoDataFrame(geometry=
gpd.GeoSeries(
gap_poly.buffer(buffer_domain),
))
gap_poly = gap_poly.explode().dissolve()

msht_buffer=clip_mesh_by_shape(msht_buffer,gap_poly.union_all())

return msht_buffer

Expand Down Expand Up @@ -3065,7 +3075,7 @@ def merge_overlapping_meshes(all_msht: list,
i in [msht_combined,msht]])

if hfun_mesh is None:
hfun_mesh = msht_combined
hfun_mesh = deepcopy(msht_combined)

buff_mesh = create_mesh_from_mesh_diff([msht_combined,msht],
carved_mesh,msht,
Expand Down

0 comments on commit a40b65a

Please sign in to comment.