public boolean intersects(double x,double y,double w,double h){
  double aw=getWidth();
  double ah=getHeight();
  if (w <= 0 || h <= 0 || aw <= 0 || ah <= 0) {
    return false;
  }
  double ext=getAngleExtent();
  if (ext == 0) {
    return false;
  }
  double ax=getX();
  double ay=getY();
  double axw=ax + aw;
  double ayh=ay + ah;
  double xw=x + w;
  double yh=y + h;
  if (x >= axw || y >= ayh || xw <= ax || yh <= ay) {
    return false;
  }
  double axc=getCenterX();
  double ayc=getCenterY();
  Point2D sp=getStartPoint();
  Point2D ep=getEndPoint();
  double sx=sp.getX();
  double sy=sp.getY();
  double ex=ep.getX();
  double ey=ep.getY();
  if (ayc >= y && ayc <= yh) {
    if ((sx < xw && ex < xw && axc < xw && axw > x && containsAngle(0)) || (sx > x && ex > x && axc > x && ax < xw && containsAngle(180))) {
      return true;
    }
  }
  if (axc >= x && axc <= xw) {
    if ((sy > y && ey > y && ayc > y && ay < yh && containsAngle(90)) || (sy < yh && ey < yh && ayc < yh && ayh > y && containsAngle(270))) {
      return true;
    }
  }
  Rectangle2D rect=new Rectangle2D.Double(x,y,w,h);
  if (type == PIE || Math.abs(ext) > 180) {
    if (rect.intersectsLine(axc,ayc,sx,sy) || rect.intersectsLine(axc,ayc,ex,ey)) {
      return true;
    }
  }
 else {
    if (rect.intersectsLine(sx,sy,ex,ey)) {
      return true;
    }
  }
  if (contains(x,y) || contains(x + w,y) || contains(x,y + h)|| contains(x + w,y + h)) {
    return true;
  }
  return false;
}

public boolean intersects ( double x , double y , double w , double h ) { double aw = getWidth ( ) ; double ah = getHeight ( ) ; if ( w <= 0 || h <= 0 || aw <= 0 || ah <= 0 ) { return false ; } double ext = getAngleExtent ( ) ; if ( ext == 0 ) { return false ; } double ax = getX ( ) ; double ay = getY ( ) ; double axw = ax + aw ; double ayh = ay + ah ; double xw = x + w ; double yh = y + h ; if ( x >= axw || y >= ayh || xw <= ax || yh <= ay ) { return false ; } double axc = getCenterX ( ) ; double ayc = getCenterY ( ) ; Point2D sp = getStartPoint ( ) ; Point2D ep = getEndPoint ( ) ; double sx = sp . getX ( ) ; double sy = sp . getY ( ) ; double ex = ep . getX ( ) ; double ey = ep . getY ( ) ; if ( ayc >= y && ayc <= yh ) { if ( ( sx < xw && ex < xw && axc < xw && axw > x && containsAngle ( 0 ) ) || ( sx > x && ex > x && axc > x && ax < xw && containsAngle ( 180 ) ) ) { return true ; } } if ( axc >= x && axc <= xw ) { if ( ( sy > y && ey > y && ayc > y && ay < yh && containsAngle ( 90 ) ) || ( sy < yh && ey < yh && ayc < yh && ayh > y && containsAngle ( 270 ) ) ) { return true ; } } Rectangle2D rect = new Rectangle2D . Double ( x , y , w , h ) ; if ( type == PIE || Math . abs ( ext ) > 180 ) { if ( rect . intersectsLine ( axc , ayc , sx , sy ) || rect . intersectsLine ( axc , ayc , ex , ey ) ) { return true ; } } else { if ( rect . intersectsLine ( sx , sy , ex , ey ) ) { return true ; } } if ( contains ( x , y ) || contains ( x + w , y ) || contains ( x , y + h ) || contains ( x + w , y + h ) ) { return true ; } return false ; }
determines whether or not the interior of the arc intersects the interior of the specified rectangle .
