public static double[] intersection(double[] kb1, double[] kb2) {
    double[] interp = new double[2];
    if (kb1[0] == 1) {
      interp[0] = kb1[1];
      interp[1] = kb2[1] * interp[0] + kb2[2];
    } else if (kb2[0] == 1) {
      interp[0] = kb2[1];
      interp[1] = kb1[1] * interp[0] + kb1[2];
    } else {
      interp[0] = (kb2[2] - kb1[2]) / (kb1[1] - kb2[1]);
      interp[1] = kb1[1] * interp[0] + kb1[2];
    }
    return interp;

  }
public static double [ ] intersection ( double [ ] kb1 , double [ ] kb2 ) { double [ ] interp = new double [ 2 ] ; if ( kb1 [ 0 ] == 1 ) { interp [ 0 ] = kb1 [ 1 ] ; interp [ 1 ] = kb2 [ 1 ] * interp [ 0 ] + kb2 [ 2 ] ; } else if ( kb2 [ 0 ] == 1 ) { interp [ 0 ] = kb2 [ 1 ] ; interp [ 1 ] = kb1 [ 1 ] * interp [ 0 ] + kb1 [ 2 ] ; } else { interp [ 0 ] = ( kb2 [ 2 ] - kb1 [ 2 ] ) / ( kb1 [ 1 ] - kb2 [ 1 ] ) ; interp [ 1 ] = kb1 [ 1 ] * interp [ 0 ] + kb1 [ 2 ] ; } return interp ; }
given two straight lines,evaluate their intersection(assuming there is a intersection between these two lines)