private static String normalize(Point p1,Point p2){
  int a, b;
  float c;
  if (p1.x == p2.x) {
    b=0;
    a=1;
    c=p1.x;
  }
 else   if (p1.y == p2.y) {
    a=0;
    b=1;
    c=p2.y;
  }
 else {
    int dx=p1.x - p2.x;
    int dy=p1.y - p2.y;
    int gcd=gcd(Math.abs(dx),Math.abs(dy));
    a=dy / gcd;
    b=dx / gcd;
    if (a * b < 0) {
      a=-1 * Math.abs(a);
      b=Math.abs(b);
    }
 else {
      a=Math.abs(a);
      b=Math.abs(b);
    }
    c=a * p1.x + b * p1.y;
  }
  return a + "|" + b+ "|"+ c;
}

private static String normalize ( Point p1 , Point p2 ) { int a , b ; float c ; if ( p1 . x == p2 . x ) { b = 0 ; a = 1 ; c = p1 . x ; } else if ( p1 . y == p2 . y ) { a = 0 ; b = 1 ; c = p2 . y ; } else { int dx = p1 . x - p2 . x ; int dy = p1 . y - p2 . y ; int gcd = gcd ( Math . abs ( dx ) , Math . abs ( dy ) ) ; a = dy / gcd ; b = dx / gcd ; if ( a * b < 0 ) { a = - 1 * Math . abs ( a ) ; b = Math . abs ( b ) ; } else { a = Math . abs ( a ) ; b = Math . abs ( b ) ; } c = a * p1 . x + b * p1 . y ; } return a + "|" + b + "|" + c ; }
use ax + by = c to represent a line and a | b | c as a key for that line a , b , c should be normalized , how ? special case , vertical , horizontal
