
    public static Complex[][] getOct(BoxModel[][] B) {
	BoxModel b=outerEdges(B);
	Complex[][] Z=getOctRaw(B);
	Complex[][] LIST={};
	for(int i=0;i<Z.length;++i) {
	    Complex[][] NEW=completeCircuit(Z[i],B[0][0].P,B[0][0].Q,B,b);
	    LIST=ListHelp.mergeList(LIST,NEW);
	}
	LIST=ListHelp.irredundantList(LIST);

	return(Z);
    }


    public static Complex[][] completeCircuit(Complex[] Z,int p,int q,BoxModel[][] B,BoxModel b) {
	boolean debug=false;

	Complex[][] W=new Complex[4][2];
	W[0]=b.trim(Z);
	for(int i=0;i<3;++i) {
	    W[i+1]=bounce(W[i],p,q,B,b);
	}
	return(W);
    }



    public static Complex[] bounce(Complex[] Z,int p,int q,BoxModel[][] B,BoxModel b) { 
	int ari=b.getAri(Z[0].SIDE);


	boolean test=BoxCombinatorics.interact(ari,Z[0].OCT);
	if(test==true) {
	    boolean test1=isPoint(B,Z[0]);
	    boolean test2=isPoint(B,Z[1]);
	    if((test1==false)&&(test2==false)) test=false;
	}

	int oct=BoxCombinatorics.partner(test,ari,Z[0].OCT);
	Complex[] W=line(Z[0],oct/2,p,q);
	W=b.trim(W);
	W[0].OCT=oct;
	W[1].OCT=oct;
	W[0].CHARGE=Z[0].CHARGE;
	W[1].CHARGE=Z[0].CHARGE;
	double d0=Complex.dist(Z[0],W[0]);
	double d1=Complex.dist(Z[0],W[1]);
	if(d1<d0) return(W);
	Complex[] W2={W[1],W[0]};
	return(W2);
    }

    public static boolean isPoint(BoxModel[][] B,Complex z) {
	for(int i=0;i<3;++i) {
	    for(int j=0;j<3;++j) {
		if(B[i][j].isPoint(z)==true) return(true);
	    }
	}
	return(false);
    }



