I have a line residing in some n-dimensional space, that needs to be discretized into a set of points. Given the
start, end points, and some the number of points
r that are needed, I can accomplish this as follows:
import numpy as np start, end = (0, 0, 0), (10, 10, 10) r = 3 dl = zip(*[np.linspace(s_i, e_i, r) for s_i, e_i in zip(start, end)])
This seems to work well enough, but I'd rather the entire thing work as a generator, and right now now the linspace has to be computed for the whole thing. How could I accomplish this?