public static mxPoint intersection(double x0,double y0,double x1,double y1,double x2,double y2,double x3,double y3){
  double denom=((y3 - y2) * (x1 - x0)) - ((x3 - x2) * (y1 - y0));
  double nume_a=((x3 - x2) * (y0 - y2)) - ((y3 - y2) * (x0 - x2));
  double nume_b=((x1 - x0) * (y0 - y2)) - ((y1 - y0) * (x0 - x2));
  double ua=nume_a / denom;
  double ub=nume_b / denom;
  if (ua >= 0.0 && ua <= 1.0 && ub >= 0.0 && ub <= 1.0) {
    double intersectionX=x0 + ua * (x1 - x0);
    double intersectionY=y0 + ua * (y1 - y0);
    return new mxPoint(intersectionX,intersectionY);
  }
  return null;
}

public static mxPoint intersection ( double x0 , double y0 , double x1 , double y1 , double x2 , double y2 , double x3 , double y3 ) { double denom = ( ( y3 - y2 ) * ( x1 - x0 ) ) - ( ( x3 - x2 ) * ( y1 - y0 ) ) ; double nume_a = ( ( x3 - x2 ) * ( y0 - y2 ) ) - ( ( y3 - y2 ) * ( x0 - x2 ) ) ; double nume_b = ( ( x1 - x0 ) * ( y0 - y2 ) ) - ( ( y1 - y0 ) * ( x0 - x2 ) ) ; double ua = nume_a / denom ; double ub = nume_b / denom ; if ( ua >= 0.0 && ua <= 1.0 && ub >= 0.0 && ub <= 1.0 ) { double intersectionX = x0 + ua * ( x1 - x0 ) ; double intersectionY = y0 + ua * ( y1 - y0 ) ; return new mxPoint ( intersectionX , intersectionY ) ; } return null ; }
returns the intersection of two lines as an mxpoint .
