I have a list of vectors, a list of scalars and a start point represented by a tuple.
vecs = [(1,1), (2,3), (-1,1)]
scalars = [2, 3, 2]
start = (-5,0)
I have a function to add "k times" a vector to a point.
def add_vector(point, k, vec):
return (point[0]+k*vec[0], point[1]+k*vec[1])
I would like to get the list of the points on the polyline such that :
result[0] = start
result[n+1] = add_vector(result[n], scalars[n], vecs[n])
I thought of using itertools.accumulate
but the func
argument must be a function of two arguments. Any ideas ?