Graphics3D[{
{RGBColor[#], Sphere[#, 1/50]} & /@ Tuples[Range[0, 1, 1/5], 3]
}
]
It gives this:

Now I want to get this one:

How? As simple as doable. Thanks in advance.
It gives this:
Now I want to get this one:
How? As simple as doable. Thanks in advance. |
||||
|
|
|
Another way is to create a 3D matrix with the points only once and utilize See, that the most important line below is the first
Detailed ExplanationLet me explain in detail what happens in this approach by using only a 2d example: A simple 2d array consisting of points can be created by
Instead of looking at this as a matrix of points, you could look at it as a list of line-points. Note how we have 3 lists of points with the same y-value and increasing x-value. Looking at the usages of
This is exactly the form we have right now and it means, we can directly use
These three lines are exactly the vertical part of the grid. Therefore
or a tiny bit shorter
gives you the required grid 2d. In 3d the approach is basically the same. The only difference is, that you have to specify exactly which level you want to transpose and you cannot simply apply Understanding this, and all the approaches in the other answers, helps always to gain a deeper understanding of how easily list-manipulation can solve such problems and to learn more about the internal structure of An application for such grids is sometimes to visualize 2d or 3d mappings. Since we now know, how the
And now you can just use a function which is applied to all points inside the
This works of course in 3d too
|
||||
|
|
|
Update :
(----------------------------)
|
||||
|
|
|
Rather than manually drawing Lines, you can use Cuboid:
|
||||
|
|
Here's how to do it using
This solution relies on a (somewhat accidental but very likely) matching order between the outputs of |
||||
|
|
|
As simple as doable? How about
|
|||||||
|
|
Cut down the number of line segments by an order of magnitude ($108$ versus $540$) by running them from one face to the opposite face rather than from each ball to the next. Here, I recycle the coordinates
|
|||
|
|
|
Continuing on VLC's code It doesn't really matter in this case, but when having lots of lines you get a speed increase by creating just one This creates one line from each ball on the edge to the ball on the opposite edge, and then issuing
If it wasn't for the coloring the same could be done for the
On my computer Perhaps there is a way to provide style options even when creating |
|||
|
|
|
... and another way using rotations:
|
||||
|
|
|
One way to do it:
|
|||
|
|