import java.util.ArrayList;
import javax.media.j3d.GeometryArray;
import javax.media.j3d.LineArray;
import javax.vecmath.Point3d;

public class cube_creation {
	public static LineArray ccr(Point3d cube_pts[]) {
		ArrayList<Point3d> cube_edges = new ArrayList<>();
		for(int i=0; i<7; i++) {
        	for(int j=i+1; j<8; j++) {
        		int counter = 0;
        		if(cube_pts[i].x==cube_pts[j].x) counter++;
        		if(cube_pts[i].y==cube_pts[j].y) counter++;
        		if(cube_pts[i].z==cube_pts[j].z) counter++;
        		if(counter==2) {
        			cube_edges.add(cube_pts[i]);
        			cube_edges.add(cube_pts[j]);
        		}
        	}
        }
		
		LineArray cube = new LineArray(cube_edges.size(),GeometryArray.COORDINATES);
        
        for(int i=0; i<cube_edges.size(); i++) {
        	cube.setCoordinate(i, cube_edges.get(i));
        }
		
		return cube;
	}
}