//order points by path for export to code
//path_order=1:194;
path_order=[137,141,177,39,142,38,140,11,145,144,178,179,171,46,164,163,180,49,186,194,193,160,181,2,165,143,129,37,135,133,128,35,146,127,147,41,161,162,152,150,12,157,42,159,43,192,158,154,6,  173,102,104,29,174,47,176,13,175,172,101,105,98,27,96,94,113,31,115,122,118,117,112,4,95,100,167,45,170,169,168,44,183,166,182,48,187,190,185,184,14,191,50,189,33,121,119,188,5,  103,67,68,20,107,30,106,9,109,108,70,71,59,17,52,51,72,22,78,90,89,88,73,1,53,69,93,28,99,97,92,26,110,91,111,32,125,126,116,114,10,123,34,124,25,87,86,120,5,  63,62,138,18,64,19,66,7,65,61,136,139,134,36,132,130,149,40,151,156,153,79,148,3,131,60,55,16,58,57,56,15,75,54,74,21,80,84,77,76,8,85,24,83,23,155,81,82,5 ];
pex=path_order; //point index
pex(2,:)=points(path_order,1); //x
pex(3,:)=points(path_order,2); //y
pex(4,:)=points(path_order,3); //z
pex(2:4,pex(1,:)==5)=%nan;
pex=round(pex*1000000)/1000000;
am=0;
for i=1:size(pex,2)
    p=pex(2:4,i);
    if pex(1,i)==5 || pex(1,i)==6
        pex(5,i)=%nan;
    else
    q=abs(pex(2,:)+p(1))+abs(pex(3,:)+p(2))+abs(pex(4,:)+p(3)); //find antipode
    [a b]=min(q);
    am=max([a am]);
    pex(5,i)=b; //antipode index
    end
end
