Okay, that was puzzling.

But I think I cracked it.

This function takes a list of points as a path and a number of samples to return, and it will integrate over the length of the path to create new points at the right distance, it also returns a list of points.

```
def resmple(points, n_samples=4, eps=0.0001):
tot_length = 0
for i in range(len(points) - 1):
pt1 = points[i]
pt2 = points[i + 1]
tot_length += (pt1 - pt2).length
cost = tot_length / n_samples
new_samples = []
wallet = 0
for i in range(len(points) - 1):
pt1 = points[i]
pt2 = points[i + 1]
tip = (pt1 - pt2).length
wallet += tip
while (wallet - cost) > -eps:
wallet -= cost
fac = -(wallet - tip) / tip
new_samples.append(pt1.lerp(pt2, fac))
return new_samples
```

edit:

## whoops, there was a bug in the first code,

it wasnt creating the first point in the correct place,

here’s the fixed function

```
def resmple(points, n_samples=4, eps=0.0001):
tot_length = 0
for i in range(len(points) - 1):
pt1 = points[i]
pt2 = points[i + 1]
tot_length += (pt1 - pt2).length
cost = tot_length / (n_samples - 1)
new_samples = [points[0]]
wallet = 0
for i in range(len(points) - 1):
pt1 = points[i]
pt2 = points[i + 1]
tip = (pt1 - pt2).length
wallet += tip
while (wallet - cost) > -eps:
wallet -= cost
fac = -(wallet - tip) / tip
new_samples.append(pt1.lerp(pt2, fac))
return new_samples
import bpy
import bmesh
bm = bmesh.from_edit_mesh(bpy.context.active_object.data)
points = [v.co for v in bm.verts]
for new_point in resmple(points, 4):
bm.verts.new(new_point)
bmesh.update_edit_mesh(bpy.context.active_object.data)
```