include first point for bezier length

This commit is contained in:
themancalledjakob 2024-08-04 15:13:05 +02:00
parent ad7d62d13e
commit b5feaa6678

View file

@ -132,7 +132,7 @@ def calc_bezier_length(bezier_point_1, bezier_point_2, resolution=20):
step = 1/resolution step = 1/resolution
previous_p = bezier_point_1.co previous_p = bezier_point_1.co
length = 0 length = 0
for i in range(0, resolution): for i in range(-1, resolution):
t = (i + 1) * step t = (i + 1) * step
p = calc_point_on_bezier(bezier_point_1, bezier_point_2, t) p = calc_point_on_bezier(bezier_point_1, bezier_point_2, t)
length += (p - previous_p).length length += (p - previous_p).length