# Adjust the results of evaluating Table so it can be used as a argument to Point

I have a list generated by Table as below.

Table[{a x1 + b x2 + c x3, a y1 + b y2 + c y3, a z1 + b z2 + c z3},
{a, -5, 5}, {b, -5, 5}, {c, -5, 5}]


but it can't be used as an argument to Point. That is,

Point[
Table[{a x1 + b x2 + c x3, a y1 + b y2 + c y3, a z1 + b z2 + c z3},
{a, -5, 5}, {b, -5, 5}, {c, -5, 5}]]


doesn't work. How do I adjust the list returned by Table to make compatible with Point?

-
Look up Flatten[]. – J. M. Jun 7 '13 at 13:52
Flatten[Table[{a x1 + b x2 + c x3, a y1 + b y2 + c y3, a z1 + b z2 + c z3}, {a, -5, 5}, {b, -5, 5}, {c, -5, 5}], 2] works fine! Problem solved. – user7932 Jun 7 '13 at 14:01
Since you've figured it out, please write an answer to your question. :) – J. M. Jun 8 '13 at 2:49

An answer has been given in the comments to the OP, but I will elaborate on it a little. I will make use a reduced data set to make this answer a little more concise.

a = Table[{a x1 + b x2 + c x1, a y1 + b y2 + c y1, a z1 + b z2 + c z1},
{a, -1, 1}, {b, -1, 1}, {c, -1, 1}];


This produces a list of depth 4:

ArrayDepth[a]


4

but what is wanted as the argument for Point is list of depth 2, i.e., a list of 3D points. That means the list must be flattened at top-level twice.

Point@Flatten[a, 2]

Point[{
{-2 x1 - x2, -2 y1 - y2, -2 z1 - z2},
{-x1 - x2, -y1 - z2},
{-x2, -y2, -z2},
{-2 x1, -2 y1, -2 z1},
{-x1, -y1, -z1},
{0, 0, 0},
{-2 x1 + x2, -2 y1 + y2, -2 z1 + z2},
{-x1 + x2, -y1 + y2, -z1 + z2},
{x2, y2, z2},
{-x1 - x2, -y1 - y2, -z1 - z2},
{-x2, -y2, -z2},
{x1 - x2, y1 - y2, z1 - z2},
{-x1, -y1, -z1}, {0, 0, 0},
{x1, y1, z1},
{-x1 + x2, -y1 + y2, -z1 + z2},
{x2, y2, z2},
{x1 + x2, y1 + y2, z1 + z2},
{-x2, -y2, -z2},
{x1 - x2, y1 - y2, z1 - z2},
{2 x1 - x2, 2 y1 - y2, 2 z1 - z2},
{0, 0, 0},
{x1, y1, z1},
{2 x1, 2 y1, 2 z1},
{x2, y2, z2},
{x1 + x2, y1 + y2, z1 + z2},
{2 x1 + x2, 2 y1 + y2, 2 z1 + z2}
}]

-