I'm trying to iterate over a list of 3D points and create a new point between each group of two points that has a distance larger than a constant value.
I've tried using a buffer unsuccesfully, my main problem is that each newly inserted point needs to respect list order and be inserted between the two points it is between geometrically.
import math
#recieve v1 and maxDist from Blender
buffer = v1
offset = 0
for i in range(len(v1) - 1):
p1 = v1[i]
p2 = v1[i+1]
if (p1 - p2).length > maxDist :
middleNode = ((p1.x+p2.x)/2,(p1.y+p2.y)/2,(p1.z+p2.z)/2)
offset = offset + 1 #
buffer.insert(i + offset, middleNode)
v2 = buffer
# send back v2 to Blender
the output that I'm having right now ressembles this while a perfectly subdivided circle is expected
