Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def interpolate_points(points, stepsize):
- new_points = []
- for i in range(len(points)-1):
- x1, y1 = points[i]
- x2, y2 = points[i+1]
- distance = math.sqrt((x2-x1)**2 + (y2-y1)**2)
- steps = int(distance/stepsize)
- for j in range(steps):
- new_points.append([x1 + j*(x2-x1)/steps, y1 + j*(y2-y1)/steps])
- new_points.append(points[-1])
- return new_points
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement