// 08.09.13 // 08.10.17 // 09.05.27 // 09.12.31 (gsort) function Out=Partitionseg(varargin) global PARTITIONPT OTHERPARTITION; Nargs=length(varargin); Fig=varargin(1); GL=varargin(2); N=3; Eps0=10^(-5); Eps=0.05; if Nargs>2 Eps=varargin(3); end; Eps2=0.2; if Nargs>3 Eps2=varargin(4); end; if Nargs>4 Ns=varargin(5); Other=Mixop(Ns,OTHERPARTITION); else Ns=1; Other=[]; OTHERPARTITION=[]; for N=1:Mixlength(GL) OTHERPARTITION=Mixadd(OTHERPARTITION,[]); end; end; Npt=size(Fig,1); ParL=[1,Npt,Other]; for N=Ns:Mixlength(GL) G=Mixop(N,GL); if Fig==G KouL=IntersectselfPp(Fig,Eps,Eps2); else KouL=IntersectcrvsPp(Fig,G,Eps,Eps2); Tmp=Nearestpt(Ptstart(Fig),G); Tmp1=Mixop(1,Tmp); Tmp2=Mixop(2,Tmp); Tmp3=Mixop(3,Tmp); if Tmp3>Eps0 & Tmp3Eps0 & Tmp3Eps Out=[Out,Tmp]; // P=PointonCurve(Tmp,Fig); PARTITIONPT=Mixadd(PARTITIONPT,P); end; end; if Out(length(Out))~=Npt Out=[Out(1:length(Out)-1),Npt]; end; if length(Out)==1 Out=[1,Npt]; end; endfunction;