Welcome to ask.woodem.org. You may post when you login through your GitHub account.

Problem with inAlignedBox and randomDensePack

0 votes
asked Jul 3, 2015 by eln0vat0 (170 points)

hi all, 

i´m very new to woo and have a problem and could really need your help. here it goes:

this very short code 

#Woo ver. 1.0+3724+26~ubuntu14.04.1
import woo
from woo import pack

sp = woo.pack.inAlignedBox((-2,-2,-2),(2,2,2));
spheres=pack.randomDensePack(predicate=sp, spheresInCell=500, radius=0.25, rRelFuzz=0.4);


returns this result:

it returns a box with sphereboxes at the vertices. i however expected a completely filled box; my concrete question is: what did i do wrong or rather what do i have to do to get a box filled with randomDensePack?

thank you in advance.



commented Jul 3, 2015 by eudoxos (49,070 points)

I reproduced the problem locally, thanks for the script. I will have a look over the weekend. václav

1 Answer

0 votes
answered Jul 4, 2015 by eudoxos (49,070 points)
selected Jul 7, 2015 by eudoxos
Best answer

Hi Ben,


all clear now. randomDensePack returns periodic packing (SpherePack.cellSize is set); that is not right. I fixed the problem in a9db3543, so you can either update (using woo -RR if you installed from git, or wait for the new package to be built), or work around the problem by adding


right before you call spheres.toSimulation(S).

What you see in the images is the periodic cell (in yellow), which is sligtly bigger (it is an internal detail of randomDensePack, the cell larger and then clipped to your predicate). Since your box is (-2,-2,-2),(2,2,2), spheres with negative coordinates wrap around and show on the top, that's the reason for 8 clusters, which are really just one. You can press 'a' in the 3d view to see axes; when you press 't' (to change perspective to orthographic) and then 'g', you will see the coordinate grid, that should make it clear what I meant.

Cheers, Václav


commented Jul 6, 2015 by eln0vat0 (170 points)

Hi Vaclav,
Thank you very much for your quick answer! Works like a charm!
Cheers Ben