@Override public boolean contains(Point2D.Double p){
  Rectangle2D.Double r=(Rectangle2D.Double)rectangle.clone();
  if (get(IS_QUADRATIC)) {
    double side=Math.max(r.width,r.height);
    r.x-=(side - r.width) / 2;
    r.y-=(side - r.height) / 2;
    r.width=r.height=side;
  }
  double grow=AttributeKeys.getPerpendicularFillGrowth(this);
  if (grow != 0d) {
    double w=r.width / 2d;
    double h=r.height / 2d;
    double lineLength=Math.sqrt(w * w + h * h);
    double scale=grow / lineLength;
    double yb=scale * w;
    double xa=scale * h;
    double growx, growy;
    growx=((yb * yb) / xa + xa);
    growy=((xa * xa) / yb + yb);
    Geom.grow(r,growx,growy);
  }
  Path2D.Double diamond=new Path2D.Double();
  diamond.moveTo((r.x + r.width / 2),r.y);
  diamond.lineTo((r.x + r.width),(r.y + r.height / 2));
  diamond.lineTo((r.x + r.width / 2),(r.y + r.height));
  diamond.lineTo(r.x,(r.y + r.height / 2));
  diamond.closePath();
  return diamond.contains(p);
}

@ Override public boolean contains ( Point2D . Double p ) { Rectangle2D . Double r = ( Rectangle2D . Double ) rectangle . clone ( ) ; if ( get ( IS_QUADRATIC ) ) { double side = Math . max ( r . width , r . height ) ; r . x -= ( side - r . width ) / 2 ; r . y -= ( side - r . height ) / 2 ; r . width = r . height = side ; } double grow = AttributeKeys . getPerpendicularFillGrowth ( this ) ; if ( grow != 0d ) { double w = r . width / 2d ; double h = r . height / 2d ; double lineLength = Math . sqrt ( w * w + h * h ) ; double scale = grow / lineLength ; double yb = scale * w ; double xa = scale * h ; double growx , growy ; growx = ( ( yb * yb ) / xa + xa ) ; growy = ( ( xa * xa ) / yb + yb ) ; Geom . grow ( r , growx , growy ) ; } Path2D . Double diamond = new Path2D . Double ( ) ; diamond . moveTo ( ( r . x + r . width / 2 ) , r . y ) ; diamond . lineTo ( ( r . x + r . width ) , ( r . y + r . height / 2 ) ) ; diamond . lineTo ( ( r . x + r . width / 2 ) , ( r . y + r . height ) ) ; diamond . lineTo ( r . x , ( r . y + r . height / 2 ) ) ; diamond . closePath ( ) ; return diamond . contains ( p ) ; }
checks if a point2d . double is inside the figure .
