Skip to content

Commit

Permalink
Removed restriction of using of clamped shapes
Browse files Browse the repository at this point in the history
I thought that I have already fixed this restriction
  • Loading branch information
Onur R. Bingol committed Feb 21, 2018
1 parent 876787c commit c2eb940
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 37 deletions.
12 changes: 6 additions & 6 deletions geomdl/BSpline.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,8 @@ def evaluate(self, **kwargs):
.. note:: The evaluated surface points are stored in :py:attr:`~curvepts`.
"""
start = kwargs.get('start', 0.0)
stop = kwargs.get('stop', 1.0)
start = kwargs.get('start', self._knot_vector[self._degree])
stop = kwargs.get('stop', self._knot_vector[-(self._degree+1)])

# Check if the input parameters are in the range
utils.check_uv(start)
Expand Down Expand Up @@ -1836,10 +1836,10 @@ def evaluate(self, **kwargs):
.. note:: The evaluated surface points are stored in :py:attr:`~surfpts`.
"""
start_u = kwargs.get('start_u', 0.0)
stop_u = kwargs.get('stop_u', 1.0)
start_v = kwargs.get('start_v', 0.0)
stop_v = kwargs.get('stop_v', 1.0)
start_u = kwargs.get('start_u', self._knot_vector_u[self._degree_u])
stop_u = kwargs.get('stop_u', self._knot_vector_u[-(self._degree_u+1)])
start_v = kwargs.get('start_v', self._knot_vector_v[self._degree_v])
stop_v = kwargs.get('stop_v', self._knot_vector_v[-(self._degree_v+1)])
# Check if all the input parameters are in the range
utils.check_uv(start_u, stop_u)
utils.check_uv(start_v, stop_v)
Expand Down
35 changes: 4 additions & 31 deletions geomdl/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,40 +245,13 @@ def check_knot_vector(degree=0, knot_vector=(), control_points_size=0, tol=0.001
# Set up a return value
ret_val = True

# A proper knot vector should have a knot vector starting with degree + 1 zeros
count = 0
start_knot = 0.0
# Check ascending order
prev_knot = knot_vector[0]
for knot in knot_vector:
if count > degree:
break
if not abs(start_knot - knot) < tol:
if prev_knot > knot:
ret_val = False
break
count += 1

# A proper knot vector should have a knot vector ending with degree + 1 ones
if ret_val:
knot_vector.reverse()
count = 0
end_knot = 1.0
for knot in knot_vector:
if count > degree:
break
if not abs(end_knot - knot) < tol:
ret_val = False
break
count += 1

knot_vector.reverse()

# Check ascending order
if ret_val:
prev_knot = knot_vector[0]
for knot in knot_vector:
if prev_knot > knot:
ret_val = False
break
prev_knot = knot
prev_knot = knot

return ret_val

Expand Down

0 comments on commit c2eb940

Please sign in to comment.