protected double angleBetween(Point2D v1,Point2D v2){
  double x1=v1.getX();
  double y1=v1.getY();
  double x2=v2.getX();
  double y2=v2.getY();
  double cross=x1 * y2 - x2 * y1;
  int cw=1;
  if (cross > 0) {
    cw=-1;
  }
  double angle=cw * Math.acos((x1 * x2 + y1 * y2) / (Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2)));
  if (Double.isNaN(angle)) {
    angle=0;
  }
  return angle;
}

protected double angleBetween ( Point2D v1 , Point2D v2 ) { double x1 = v1 . getX ( ) ; double y1 = v1 . getY ( ) ; double x2 = v2 . getX ( ) ; double y2 = v2 . getY ( ) ; double cross = x1 * y2 - x2 * y1 ; int cw = 1 ; if ( cross > 0 ) { cw = - 1 ; } double angle = cw * Math . acos ( ( x1 * x2 + y1 * y2 ) / ( Math . sqrt ( x1 * x1 + y1 * y1 ) * Math . sqrt ( x2 * x2 + y2 * y2 ) ) ) ; if ( Double . isNaN ( angle ) ) { angle = 0 ; } return angle ; }
returns the angle between two vectors from the origin to points v1 and v2 .
