ericbrec / BSpy

Library for manipulating and rendering non-uniform b-splines.
MIT License
1 stars 0 forks source link

inconsistent calling of `f` when calling Spline.fit #68

Open ze897c opened 1 month ago

ze897c commented 1 month ago

Hi Eric & Tom,

It's Matt. Sorry it took me so long to get into it, but I have a chargeline now, so I am enabled!!

I am trying to use Spline.fit and first call (finding midpoint) passes me a tuple and thereafter a np.ndarray. I am fine with either, but think UX is better if we don't need to convert.

Thanks, guy....more to come! Best, Matt

`import bspy as bs import numpy as np

def f(x: np.ndarray) -> np.ndarray: print(x) try: return np.asarray([x, x2, x3]).T except Exception as e: _ = np.asarray([x, x 2, x 3]).T

if name == 'main': gamma = bs.Spline.fit( domain=np.asarray([[0, 1]]).astype(np.float64), f=f,

order=np.asarray([3]),

    # knots=np.linspace(0, 1, 21),
)

[0.5] (np.float64(0.0),) `