Generate a network graph inside a cylinder

59 Views Asked by At

I need to solve a problem and I'm really stuck with it, so I want to summon the power of the community to see if anyone has an idea on how to handle it.

I need to create a porous material from a given surface . So, I have a point cloud representing the surface of a cylinder, like the one in the figure, and I need to generate a graph inside it from the points on the surface to be filled with volume. It is mandatory that all the points of the surface are used (some more can be added if necessary), the length of the edges must be an input parameter of the function and the angle between two nodes must always be greater than 45º with respect to the horizontal plane.

Point cloud representing the surface of the cylinder

My initial idea was to make a while loop that in each iteration creates a random point cloud inside the cylinder between the current z (the current z is the maximum z value of the previous iteration) and the current z + the given edge length. Once this point cloud is created, it joins the surface nodes of the last iteration with the points of this point cloud that satisfy the condition of edge length and angularity. And it continues until the current z is greater than the maximum z of the cylinder surface.

The problem with this idea is that it is not consistent and the results are disastrous. So I would like to ask if anyone has a better idea or if anyone knows if any python libraries could help me. I am currently using networkx and numpy-stl but those are not meant to do what I want. ChatGPT is unable to understant me too :(.

This is an example of how the final mesh should look like, more or less

Thank you so much for you time!!

0

There are 0 best solutions below