remove variable type change
@@ -25,11 +25,11 @@ def cubic_bezier_interpolation(
from ezdxf.math import tridiagonal_matrix_solver
# Source: https://towardsdatascience.com/b%C3%A9zier-interpolation-8033e9a262c2
- points = Vec3.tuple(points)
- if len(points) < 3:
+ pnts = Vec3.tuple(points)
+ if len(pnts) < 3:
raise ValueError("At least 3 points required.")
- num = len(points) - 1
+ num = len(pnts) - 1
# setup tri-diagonal matrix (a, b, c)
b = [4.0] * num
@@ -40,22 +40,22 @@ def cubic_bezier_interpolation(
a[num - 1] = 2.0
# setup right-hand side quantities
- points_vector = [points[0] + 2.0 * points[1]]
+ points_vector = [pnts[0] + 2.0 * pnts[1]]
points_vector.extend(
- 2.0 * (2.0 * points[i] + points[i + 1]) for i in range(1, num - 1)
+ 2.0 * (2.0 * pnts[i] + pnts[i + 1]) for i in range(1, num - 1)
)
- points_vector.append(8.0 * points[num - 1] + points[num])
+ points_vector.append(8.0 * pnts[num - 1] + pnts[num])
# solve tri-diagonal linear equation system
solution = tridiagonal_matrix_solver((a, b, c), points_vector)
control_points_1 = Vec3.list(solution.rows())
control_points_2 = [
- p * 2.0 - cp for p, cp in zip(points[1:], control_points_1[1:])
+ p * 2.0 - cp for p, cp in zip(pnts[1:], control_points_1[1:])
]
- control_points_2.append((control_points_1[num - 1] + points[num]) / 2.0)
+ control_points_2.append((control_points_1[num - 1] + pnts[num]) / 2.0)
for defpoints in zip(
- points, control_points_1, control_points_2, points[1:]
+ pnts, control_points_1, control_points_2, pnts[1:]
):
yield Bezier4P(defpoints)
