changeset 12507:bb9135dcce26 octave-forge

Check that the knots are in the interval
author rafavzqz
date Mon, 14 Jul 2014 14:59:37 +0000
parents 411dde236c34
children ea796fbdadf7
files extra/nurbs/inst/nrbkntins.m
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/extra/nurbs/inst/nrbkntins.m	Mon Jul 14 10:23:51 2014 +0000
+++ b/extra/nurbs/inst/nrbkntins.m	Mon Jul 14 14:59:37 2014 +0000
@@ -91,6 +91,11 @@
 degree = nurbs.order-1;
 
 if iscell(nurbs.knots)
+ fmax = @(x,y) any (y > max(x)); fmin = @(x,y) any (y < min(x));
+ if (any(cellfun(fmax, nurbs.knots, iknots)) || any(cellfun(fmin, nurbs.knots, iknots)))
+   error ('Trying to insert a knot outside the interval of definition')
+ end
+    
  if size(nurbs.knots,2)==3
   % NURBS represents a volume
   num1 = nurbs.number(1);
@@ -160,6 +165,9 @@
  end
 else
 
+  if (any(iknots > max(nurbs.knots)) || any(iknots < min(nurbs.knots)))
+    error ('Trying to insert a knot outside the interval of definition')
+  end
   % NURBS represents a curve
   if isempty(iknots)
     coefs = nurbs.coefs;