This is actually a meshgrid in a point-cloud form (n, 3).
This code does it, and all is left is to vectorize, which I am struggling with.
Maybe some stride tricks + repeats are required here?
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
dim_len = 5
x = np.linspace(0., 1., dim_len)
y = np.linspace(0., 1., dim_len)
z = np.linspace(0., 1., dim_len)
n_points = dim_len ** 3
point_cloud = np.zeros((n_points, 3))
# TODO vectorize
point_ind = 0
for i in range(dim_len):
for j in range(dim_len):
for k in range(dim_len):
point_cloud[point_ind, 0] = x[i]
point_cloud[point_ind, 1] = y[j]
point_cloud[point_ind, 2] = z[k]
point_ind += 1
print(point_cloud)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.scatter(point_cloud[:, 0], point_cloud[:, 1], point_cloud[:, 2],)
plt.show()