Cylinders not randomly distributed in x-y plane from generators.cylinders
See original GitHub issueDue to some property of how random fiber locations are selected, fibers are more likely to cross near the center of the x-y plane versus point closer to the edge. This code makes a structure, then calculates the porosity at each x-y location.
import porespy as ps
import matplotlib.pyplot as plt
import numpy as np
im = ps.generators.cylinders([400,400,1000],5, 7000,0,90,None)
mean = np.mean(im,2)
plt.imshow(mean,cmap='plasma')
plt.show()
print(ps.metrics.porosity(im))
Results:

A more dramatic example for a 1000x1000x1000 fiber image with a porosity of 0.5.

Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Directrix - an overview | ScienceDirect Topics
As the generatrix moves along the directrix so that it stays always parallel to a given direction, it generates the surface of a...
Read more >Interference fit in cylinders - Ansys Learning Forum
i am trying to create an interference fit betwwen two cylinders on Ansys and as soon as extrude the seconde cylinder they get...
Read more >Finite element study of displacement controlled fretting in ...
Two mechanical models relative to the X-Y plane are consistent. The interface between the two cylinders is described by the Coulomb friction ...
Read more >Scattering by closely spaced parallel nonhomogeneous ...
The angle ϕ1 is commonly called the angle of incidence on the cylinder, as it is inclined from the XY plane that is...
Read more >6.3 Applying Gauss's Law - University Physics Volume 2
A charge distribution has cylindrical symmetry if the charge density depends only upon the distance r from the axis of a cylinder and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I am going to merge this change into dev since you’re ok with it. I will close this issue now.
@1minus1 I implemented something close to your quick fix in PR #245. The starting points are generated over a much larger region now. I basically increase the region by the requested cylinder length on all sides. Anything more than that would be pointless since the the generated cylinder would not reach that actual domain. I did this without actually creating a larger image, which is good. The down side, as you say is that more tries are required to get the correct number of cylinders. The function was still decently fast on my laptop though, but I didn’t compare times. Let me know if this new version works better for you. We can still discuss the porosity thing separately, but at least you’ll have a valid function to build on!