Skip to content

Commit

Permalink
Fix slicing in knot removal
Browse files Browse the repository at this point in the history
  • Loading branch information
Onur R. Bingol committed Jul 6, 2021
1 parent 5e20a54 commit 7fb96df
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion geomdl/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ def knot_removal(degree, knotvector, ctrlpts, u, **kwargs):
j += 1

# Slice to get the new control points
ctrlpts_new = ctrlpts_new[0:-t]
ctrlpts_new = ctrlpts_new[0:-(tx-1)]
else:
raise GeomdlException("Cannot remove knot: " + str(u))

Expand Down

2 comments on commit 7fb96df

@portnov
Copy link

@portnov portnov commented on 7fb96df Jul 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if remflag:
i = first
j = last
while j - i > t:
ctrlpts_new[i] = temp[i - first + 1]
ctrlpts_new[j] = temp[j - first + 1]
i += 1
j -= 1
tx += 1

@orbingol
Shouldn't we add else: break here? What is the point in trying to remove the knot (N+1)th time if we failed to remove it N'th time?

@orbingol
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very minor detail. It might have a very small performance improvement but I don't think it will be noticeable considering the industry mainly uses quadratic and cubic geometries. There is some research on higher degree geometries but the degree they are considering is still less than 10.

Please sign in to comment.