Hi Václav! > > Well, use pack.regularHexa(...) with pack.inAlignedBox. Is there a way to > > create such packings with pack.SpherePack()? Or how can I convert it in a > > SpherePack()? I tried to pass the regularHexa packing to the SpherePack, > > dosen't work. If this is going to work somehow it would be enough for my > > purposes. > > Oh, ding it -- I thought pack's packers (regularHexa etc) were returning > SpherePack instances, but in reality they return list of bodies already > (I should know, since it is my code, sorry)! > > Now, I think it would be more logical for them to return SpherePack's, > since they are just centers+positions, what one would expect (perhaps > there are some issues why I decided to return bodies directly that I > don't see now), and then one might to call SpherePack.toSimulation() to > add them to O.bodies (or a similar function). (I would add some > additional argument, to make it backwards-compatible for some time, so > that old code would work as it did and give warning about future break). > Are you using trunk? Would it be useful for you?
I am using the 0.5 release right now. But I think that I will move to the trunk soon. Well, sure it would be useful for me, but there is no hurry since what you proposed below is working for now. > Meanwhile, you can change spheres' positions by hand in a loop, like this: > > from yade import pack > pred=pack.inAlignedBox((10.,0.,0.),(20,20,1.5)) > hexapack=pack.regularHexa(pred,radius=0.5,gap=0.0,color=(0,1,0)) > # define around which point to rotate, and the rotation itself > p0=Vector3(10,10,10); rot=Quaternion((0,1,0),-pi/4) > # apply to all spheres in the packing > for b in hexapack: b.state.pos=p0+rot*(b.state.pos-p0) > # add to the simulation (it does not matter if you add particles to > simulation first or rotate them first, really) > O.bodies.append(hexapack) This is working! > >> The reason I did not create general box orientation is that checking > >> whether particle is inside or outside is more complicated; but now I > >> have the idea that it could be actually done by keeping corners and box > >> transformation in the predicate, then transforming points to be checked, > >> rather than checking points against true (non-aligned) boundaries. > > > > Hm, I am a newbie and I still have to understand the difference between > > the two packing options. By the way, what's the difference? Can't you > > just use predicates? > > The two have orthogonal meanings. Packers defines the pattern (texture, > sphere configuration, ... -- however you would like to call it) whereas > predicate defines the volume where it will be created. E.g. hexagonal > packer will create hexagonal configuration in volume given by > inAlignedBox, but it can be created in a cylinder, in a volume defined > as intersection of box with sphere, and so on. Thanks. > (That makes me think that I could also add something like inHalfSpace > (oriented clipping plane) predicate, then you could create e.g. box and > clip it by 2 arbitrary planes from each side; or define a box-like > volume with 6 of such planes.) Good idea! _______________________________________________ Mailing list: https://launchpad.net/~yade-users Post to : [email protected] Unsubscribe : https://launchpad.net/~yade-users More help : https://help.launchpad.net/ListHelp

