Я попробовал следующее:
Код: Выделить всё
from scipy.interpolate import make_interp_spline
import numpy as np
def magnitude(x, y):
return np.sqrt(x**2 + y**2)
t = np.linspace(0, 1, 10)
xy = np.zeros(shape=(t.shape[0], 2))
xy[:,0] = 5*t
xy[:,1] = 2.5*t
tangent_start = (-0.9243451992527411, -0.38155727305138615)
tangent_end = (-0.8379592954605802, -0.5457327360083948)
# Passing in the tangent components
spline = make_interp_spline(t, xy, bc_type=([(1, tangent_start[0], 1, tangent_start[1])], [(1, tangent_end[0], 1, tangent_end[1])]))
*** ValueError: слишком много значений для распаковки (ожидается 2)
Затем я попробовал просто использовать величины:
Код: Выделить всё
spline = make_interp_spline(t, xy, bc_type=([(1, magnitude(tangent_start))], [(1, magnitude(tangent_end))])
However, I get the following error:
*** ValueError: cannot reshape array of size 1 into shape (2)
Подробнее здесь: https://stackoverflow.com/questions/792 ... -2d-arrays
Мобильная версия