Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non manifold interface between two meshes #209

Open
SalvishGoomanee opened this issue Mar 6, 2023 · 0 comments
Open

Non manifold interface between two meshes #209

SalvishGoomanee opened this issue Mar 6, 2023 · 0 comments

Comments

@SalvishGoomanee
Copy link

I would like to know if it is possible to create the non-manifold interface when two surface meshes merge together?

Is this implemented in PyGalmesh or do we have to code it by hand?

Here is my code which results in the merging of two Balls whose surfaces are both meshed:


import pygalmesh
import pyvista as pv 

# Merge two meshes PyGalmesh
radius = 1.0
displacement = 0.5
s0 = pygalmesh.Ball([displacement, 0, 0], radius)
s1 = pygalmesh.Ball([-displacement, 0, 0], radius)
u = pygalmesh.Difference(s0, s1)

# add circle
a = np.sqrt(radius ** 2 - displacement ** 2)
max_edge_size_at_feature_edges = 0.15
n = int(2 * np.pi * a / max_edge_size_at_feature_edges)
alpha = np.linspace(0.0, 2 * np.pi, n + 1)
alpha[-1] = alpha[0]
circ = a * np.column_stack([np.zeros(n + 1), np.cos(alpha), np.sin(alpha)])

mesh = pygalmesh.generate_surface_mesh(
    u,
    # extra_feature_edges=[circ],
    # max_cell_circumradius=0.15,
    # max_edge_size_at_feature_edges=max_edge_size_at_feature_edges,
    min_facet_angle=25,
    max_radius_surface_delaunay_ball=0.15,
    # max_circumradius_edge_ratio=2.0,
)

mesh.write('double_mesh.mesh')
display = pv.read('double_mesh.mesh')
display.plot(style='wireframe', color='tan', show_scalar_bar=False, show_axes=False, show_edges=True)

# display the two meshes merged together - this should normally create a non-manifold interface...?
union = pygalmesh.Union([u, s1])
mesh_union = pygalmesh.generate_surface_mesh(union,
                                             # max_cell_circumradius=0.15,
                                             # max_edge_size_at_feature_edges=max_edge_size_at_feature_edges,
                                             min_facet_angle=25,
                                             max_radius_surface_delaunay_ball=0.15,
                                             # max_circumradius_edge_ratio=2.0
                                             )

mesh_union.write('double_mesh_union.mesh')
display = pv.read('double_mesh_union.mesh')
display.plot(style='wireframe', color='tan', show_scalar_bar=False, show_axes=False, show_edges=True)

Thank you for any input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant