Skip to content

Commit

Permalink
Fix a bug in NURBS.Surface class derivatives method
Browse files Browse the repository at this point in the history
  • Loading branch information
Onur R. Bingol committed Jan 31, 2018
1 parent d65a4a0 commit b3cca76
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions geomdl/NURBS.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"""

from copy import deepcopy
import geomdl.BSpline as BSpline
import geomdl.utilities as utils

Expand Down Expand Up @@ -451,9 +452,8 @@ def derivatives(self, u=-1, v=-1, order=0):

for k in range(0, order + 1):
for l in range(0, order - k + 1):
v = []
for idx in range(self._dimension - 1):
v.append(SKLw[idx])
# Deep copying might seem a little overkill but we also want to avoid same pointer issues too
v = deepcopy(SKLw[k][l])

for j in range(1, l + 1):
v[:] = [tmp - (utils.binomial_coefficient(l, j) * SKLw[0][j][-1] * drv) for tmp, drv in
Expand All @@ -467,7 +467,7 @@ def derivatives(self, u=-1, v=-1, order=0):
zip(v2, SKL[k - i][l - j])]
v[:] = [tmp - (utils.binomial_coefficient(k, i) * tmp2) for tmp, tmp2 in zip(v, v2)]

SKL[k][l][:] = [tmp / SKLw[0][0][-1] for tmp in v]
SKL[k][l][:] = [tmp / SKLw[0][0][-1] for tmp in v[0:3]]

# Return S(u,v) derivatives
return SKL

0 comments on commit b3cca76

Please sign in to comment.