function detbspln
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% determination of the classification of b-splines for 1D
% n                  : degree
% xx                 : position of nodes
% D                  : all b-splines supporting the region 
% bb                 : inner(2) and outer(1) b-splines
% gi                 : inner b-splines
% gj                 : outer b-splines
%
% Created by G.Apaydin in June 2006
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global xi xe n gi gj bb xx D
nn=length(xx);e=(xx>=xi)&(xx<=xe);
%----------------------------DETERMINE BSPLINES----------------------------
bb=zeros(1,nn-(n+1));
for i=1:nn-(n+1),bb(i)=sum(e(i:i+n+1))>0;end
for i=n+1:nn-(n+1),if (sum(e(i:i+1))>1.9), bb(i-n:i)=2;end,end
D=[];for i=1:nn-(n+1),D=[D;i xx(i)];end,
gi=find(bb==2);gj=find(bb==1);%inner and outer b-splines