Using the below commands, a simple lattice configuration can be generated:
Cube = Normal@LatticeData["SimpleCubic", "Basis"];
LatPos = Flatten[Table[i Cube[[1]] + j Cube[[2]] + k Cube[[3]], {i, 0, 100,
5}, {j, 0, 100, 5}, {k, 0, 10, 5}], 2];
Graphics3D[Map[Sphere[#, parsize] &, #], Boxed -> True, Axes -> True] & /@ {LatPos}
for particle size (parsize) equals to one, one can have:
At the next step, I need to move these particles in the random directions (starting with small movement) in the condition that particles do not overlap. I used the below code to generate the movements and check if they have intersections or not. However, it took forever to run when the number of particles is large.
maxRanNum = 0.5;
LatPos2 = {}; Do[Label[ran]; r = RandomReal[{-maxRanNum, maxRanNum}, 3];If[0 <= r[[1]] + LatPos[[i]][[1]] <= 100 && 0 <= r[[2]] + LatPos[[i]][[2]] <= 100 && 0 <= r[[3]] + LatPos[[i]][[3]] <= 10,LatPos2 = AppendTo[LatPos2, LatPos[[i]] + r],Goto[ran]], {i, Length[LatPos]}];
Graphics3D[Map[Sphere[#, parsize] &, #], Boxed -> True, Axes -> True] & /@ {LatPos2}
and to check the itersections:
Do[If[i == j, Continue[]]; intersection = RegionMeasure[RegionIntersection[Sphere[LatPos2[[i]], parsize],Sphere[LatPos2[[j]], parsize]]];
If[intersection != 0, Print[false];
Break[], Continue[]], {i, Length[LatPos2]}, {j, Length[LatPos2]}]
so I suppose that creating the movement of the lattice particles need to be coded together with the overlapping check. But I do not know how it can be done. I appreciate your help in this matter.
VoronoiMesh
works only for 1D and 2D. This q/a may be useful. See also TriangulateMesh and Insphere. $\endgroup$