Skip to main content
21 events
when toggle format what by license comment
Aug 17, 2017 at 14:55 comment added skonda2 @bbgodgrey I understand I may have added a lot of additional constraints. I will modify the question in edits. I have marked the answer as correct, since it does most of the things. Feel free to improve the code as and when you get time.
Aug 17, 2017 at 14:54 vote accept skonda2
Aug 17, 2017 at 2:00 comment added bbgodfrey @skonda2 Replacing > 2 (r1 + r2)^2 by > 9 (r1 + r2)^2 in int eliminates the intersecting cylinders. But, it is not very efficient. Remember, though, that your question related to cylinders with aspect ratios of order unity, and that is the question I successfully answered. You should not expect the same approach to work well for high aspect ratios. In fact, I now do know how to eliminate intersecting cylinders with high efficiency no matter what the aspect ratio, but I shall not have time to code it for a few weeks.
Aug 16, 2017 at 21:53 comment added skonda2 When I run the above code in mathematica, I could see see overallping cylinders. The conditions were n = 42, ict = 2000000, r1=5 and hlf = 30.
Aug 14, 2017 at 15:49 comment added bbgodfrey @skonda2 The code had been tuned for cylinders with aspect ratios of order unity, as originally requested in the question. I have now modified the code for more general aspect ratios, as a result of which the number of cylinders generated is a bit less. Note also that I have rescaled ict. I should add that I now know how to improve the code efficiency but will not have time to do so for a few weeks.
Aug 14, 2017 at 15:47 history edited bbgodfrey CC BY-SA 3.0
adjusted code to accommodate wider range of aspect ratios; corrected typo
Aug 13, 2017 at 19:17 comment added skonda2 Is something wrong with the code? I tried to run them for n=42, ict = 5000, r1=5 and hlf = 30. I am getting errors.
Aug 9, 2017 at 12:58 history edited bbgodfrey CC BY-SA 3.0
added final sentences and the parameter `n`.
Aug 9, 2017 at 12:18 comment added skonda2 I am not looking for high packing fractions. So, a reasonable "n" would be useful. At the end, I would have a code that could generate random non-overlapping cylinders with specified aspect ratio and specified number. Could you show how to add n?
Aug 9, 2017 at 1:02 comment added skonda2 The code runs now, however I can see multiple overlapping cylinders in mathematica. Is it something to do with the int or inb function? In addition, Is there a way we could incorporate a input parameter "n", which decides the number of cylinders inside the cube?
Aug 7, 2017 at 0:49 history edited bbgodfrey CC BY-SA 3.0
fixed typo
Aug 6, 2017 at 20:23 comment added skonda2 What does (* {29.8132, 78} *) mean? I know 78 is the number of cylinders. What does 29.81 mean, is it time? Also, ict value of 5000, do you think it should be 500000?
Aug 6, 2017 at 19:02 history edited bbgodfrey CC BY-SA 3.0
typo corrected
Aug 6, 2017 at 15:54 comment added bbgodfrey I found and fixed a typo in inb. The simplest way to export the cylinder data as text is Export["C:\\Temp\\cyls.txt", c], where the first argument is the location to which the data is to be exported. By the way, I now know how to make int exact, which will permit a few more cylinders to be packed into the box. It will take me a while to implement the code. Please do not forget to upvote and accept my answer, if it meets your needs.
Aug 6, 2017 at 15:49 history edited bbgodfrey CC BY-SA 3.0
fixed typo
Aug 6, 2017 at 15:11 comment added skonda2 I am having a hard time putting together the whole code. Some error pops out when I attach everything. The pictures you generated are pretty much what I am looking for. Do you know, how export the co-ordinates in a text file (x1,y1,z1) & (x2,y2,z2)?
Aug 6, 2017 at 4:14 history edited bbgodfrey CC BY-SA 3.0
second addendum added
Aug 6, 2017 at 1:58 history edited bbgodfrey CC BY-SA 3.0
fixed error in inb and correspoinding plots
Aug 5, 2017 at 20:43 history edited bbgodfrey CC BY-SA 3.0
added addendum
Aug 5, 2017 at 17:20 history edited bbgodfrey CC BY-SA 3.0
Revised initial definition of cylinders to more even distribute them in box
Aug 5, 2017 at 2:33 history answered bbgodfrey CC BY-SA 3.0