← Back to team overview

yade-users team mailing list archive

Re: Arbitrary aligned box or plane


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
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?

Meanwhile, you can change spheres' positions by hand in a loop, like this:

from yade import pack
# 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)

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
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.

(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.)

Probably not directly (though you could create a thin volume for
instance). Can you be more specific as to what usage you have in mind?
Thin volume works fine.
Good :-)

Follow ups