# Problem with inAlignedBox and randomDensePack

145 views

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

S=woo.master.scene=woo.core.Scene()
sp = woo.pack.inAlignedBox((-2,-2,-2),(2,2,2));

spheres.toSimulation(S)


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?

cheers,

ben

commented Jul 3, 2015 by (49,030 points)

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

answered Jul 4, 2015 by (49,030 points)
selected Jul 7, 2015 by eudoxos

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

spheres.cellSize=(0,0,0)

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 (170 points)

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