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

Create rectangular based pyramids and find intersections #129

Open
ConnorM17 opened this issue Feb 10, 2021 · 1 comment
Open

Create rectangular based pyramids and find intersections #129

ConnorM17 opened this issue Feb 10, 2021 · 1 comment

Comments

@ConnorM17
Copy link

ConnorM17 commented Feb 10, 2021

Hi, I am trying to create a couple rectangular based pyramids and then find the resulting mesh after using pygalmesh.Intersection.

  • Is there a way to create a rectangular based pyramid with pygalmesh?
  • If I create say 4 of these rectangular based pyramids would I be able to use something like,

u = pygalmesh.Intersection([p1, p2, p3, p4])
to find the resulting mesh?

Currently I am trying to create a rectangular based pyramid from two tetrahedrons...

import numpy
import pygalmesh
import meshplex
import meshio

s1 = pygalmesh.Tetrahedron(
    [0.0, 0.0, 0.0], [1.0, -1.0, 1.0], [1.0, 1.0, 1.0], [-1.0, -1.0, 1.0],
)
s2 = pygalmesh.Tetrahedron(
    [0.0, 0.0, 0.0], [-1.0, 1.0, 1.0], [1.0, 1.0, 1.0], [-1.0, -1.0, 1.0]
)
u = pygalmesh.Intersection([s1, s2])
mesh = pygalmesh.generate_mesh(
    u,
    max_cell_circumradius=0.15,
    max_edge_size_at_feature_edges=0.15,
)
mesh.write("out.vtk")

However, this just seems to run forever and eventually segfault.
Any tips?

@nschloe
Copy link
Collaborator

nschloe commented Feb 12, 2021

You probably mean to use the union, not the intersection, but nevertheless CGAL has problems with unions which share a common surface.

The best solution would probably be to submit a PR for adding another primitive. Check out the tetrahedron definition here.

It'd be great if we could get a general convex hull primitive here. This would require finding the hull's feature edges and determining if a point is inside the convex hull. See here for an approach that generalizes barycentric coordinates (as used for tetra right now).

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

2 participants