changeset 12509:3da251f2ae4b octave-forge

Added error message
author rafavzqz
date Wed, 16 Jul 2014 16:46:07 +0000
parents ea796fbdadf7
children a346bc0f24ec
files extra/nurbs/inst/nrbextract.m
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/extra/nurbs/inst/nrbextract.m	Tue Jul 15 16:54:30 2014 +0000
+++ b/extra/nurbs/inst/nrbextract.m	Wed Jul 16 16:46:07 2014 +0000
@@ -2,6 +2,7 @@
 
 %
 % NRBEXTRACT: construct NURBS curves by extracting the boundaries of a NURBS surface, or NURBS surfaces by extracting the boundary of a NURBS volume.
+% It only works for geometries constructed with open knot vectors.
 % 
 % Calling Sequence:
 % 
@@ -28,7 +29,7 @@
 %    5: W = 0 (only for volumes)
 %    6: W = 1 (only for volumes)
 %
-%    Copyright (C) 2010 Rafael Vazquez
+%    Copyright (C) 2010,2014 Rafael Vazquez
 %
 %    This program is free software: you can redistribute it and/or modify
 %    it under the terms of the GNU General Public License as published by
@@ -44,7 +45,15 @@
 %    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 if (~iscell (srf.knots))
-  error('The boundary information is only extracted for NURBS surfaces or volumes');
+  error('The boundary information is only extracted for NURBS surfaces or volumes');  
+end
+
+for idim = 1:numel(srf.knots)
+  ord = srf.order(idim);
+  if (srf.knots{idim}(1) ~= srf.knots{idim}(ord) || ...
+      srf.knots{idim}(end) ~= srf.knots{idim}(end-ord+1))
+    error ('nrbextract: only working for open knot vectors')
+  end
 end
 
 if (numel (srf.knots) == 2)