Describe the bug
When using curves with unclamped knotvector, if you try to insert a knot near the right end of knotvector (more precisely, try to insert u_bar which is greater than u[-p-1], where u is knotvector, p is curve's degree) - control points are calculated incorrectly.
To Reproduce
As simple example, consider the curve of degree = 2, with control points:
[[0, 0, 0], [1, 1, 0], [2,1,0], [3, 0, 0]]
and knotvector = [0, 1, ..., 6]. Now try to call operations.insert_knot with u_bar = 4. Expected control points of resulting curve are:
I believe the problem is here: https://github.com/orbingol/NURBS-Python/blob/5.x/geomdl/operations.py#L82find_span_linear is implemented in such a way that it never returns value greater than num_ctrlpts. Maybe it is good in some situations, but not in this one.
I had similar problem in Sverchok, and for me the solution was
Describe the bug When using curves with unclamped knotvector, if you try to insert a knot near the right end of knotvector (more precisely, try to insert
u_bar
which is greater thanu[-p-1]
, whereu
is knotvector,p
is curve's degree) - control points are calculated incorrectly.To Reproduce As simple example, consider the curve of degree = 2, with control points:
and knotvector = [0, 1, ..., 6]. Now try to call
operations.insert_knot
with u_bar = 4. Expected control points of resulting curve are:but Geomdl calculates:
Configuration:
Additional Details (Optional)
I believe the problem is here: https://github.com/orbingol/NURBS-Python/blob/5.x/geomdl/operations.py#L82
find_span_linear
is implemented in such a way that it never returns value greater thannum_ctrlpts
. Maybe it is good in some situations, but not in this one. I had similar problem in Sverchok, and for me the solution was