yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #23187
Re: [Question #690948]: Making a sphere layer with certain orientation
Question #690948 on Yade changed:
https://answers.launchpad.net/yade/+question/690948
Status: Open => Answered
Jan Stránský proposed the following answer:
yes, thanks. So basically:
1) create the aligned layer
2) rotate it
### MWE
from yade import pack
# "aligned" layer
layer = pack.regularOrtho(pack.inAlignedBox((0,0,0),(20,20,5)),1,0)
# rotation (can be also any other transformation, like shift, scale etc.)
center = Vector3(0,0,0) # center of rotation
rotation = Quaternion((1,0,0),.25*pi) # Quaternion(rotationAxis,rotationAngle)
for b in layer: # apply the transformation for each sphere of the layer
b.state.pos = center + rotation * (b.state.pos - center)
O.bodies.append(layer)
###
cheers
Jan
--
You received this question notification because your team yade-users is
an answer contact for Yade.