orbingol / NURBS-Python

Object-oriented pure Python B-Spline and NURBS library
https://onurraufbingol.com/NURBS-Python/
MIT License
636 stars 156 forks source link

Order 1 fitting approximation wit 2 points failed with Error #124

Open Shegrad opened 3 years ago

Shegrad commented 3 years ago

Describe the bug I try to approximate a 3D line using geomdl routines from fitting. I thought that the following code should be OK : from geomdl import fitting as fit approx_line = fit.approximate_curve([[0,0,0],[1,1,1],[2,2,2]], degree=1, ctrlpts_size=2)

but I got the following error : File "C:\Users\F278562\Desktop\morphotex\venv\lib\site-packages\geomdl\fitting.py", line 160, in approximate_curve matrix_ntn = linalg.matrix_multiply(matrix_nt, matrix_n) File "C:\Users\F278562\Desktop\morphotex\venv\lib\site-packages\geomdl\linalg.py", line 457, in matrix_multiply p1 = len(mat1[0]) IndexError: list index out of range

Can you help me getting an approximation for an order 1 spline of 2 points ?

Expected Behavior I thought that I would have obtained a order 1 spline that were a least square approximation of the point list

Configuration: