← Back to team overview

yade-users team mailing list archive

Re: [Question #271877]: Extract 2D cross-sections from the 3D sphere pack.

 

Question #271877 on Yade changed:
https://answers.launchpad.net/yade/+question/271877

    Status: Answered => Open

Ram is still having a problem:
Thanks for your reply Jerome. Sorry for the delay.

There was a mix up in posting my question above. Essentially, I am
trying to convert the following Matlab code to Python:

[X,Y,Z] = meshgrid(linspace(1,cylRad,100),linspace(1,cylRad,100),linspace(1,cylHt,100));
F = zeros(size(X));
for i = 1:numParticles
    F( sqrt((X - spherePos(i,1)).^2 + (Y - spherePos(i,2)).^2 + (Z - spherePos(i,3)).^2) <= sphereRad(i) ) = 128;
end

In the above code, cylRad, cylHt, are defined. numParticles is
essentially len(O.bodies) and spherePos is an array of the centers of
the spheres in the packing. The above code essentially sets a value of
128 for the voxels belonging to spheres and 0 elsewhere. So, in
particular I am having difficulty in the line assigning value 128 in
array F.

--
Thanks.

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.