Hi All!
I am new here and I just start developing addons for blender.
I am trying to distribute objects evenly along a bezier curve. The problem is that curve is composed with different segments and lengths.
My approach is calculate the chunk that belongs to each object, and then, for each segment start to divide the curve.
The problem comes when a chunk is in between two segments, and how to fix the last position in order to take advantage of the entire length of the curve.
L_total = sum(L_seg)
step = 1/N
r = 0
acum = 0
new_locs = []
for i in range(N_seg):
acum = 0
acum = r
t = (step * L_total) / L_seg[i]
while (acum <= 1):
new_loc = self.spline_eval(acum, points[i].co, points[i].handle_right, points[i+1].co, points[i+1].handle_left)
new_locs.append(new_loc)
acum += t
if i == 0 or i == N_seg-1:
r = (acum - 1)
else:
r = (acum - 1) * L_seg[i] / L_seg[i-1]
Any ideas?
Thank you!!