public final void bounds(int range){
  double x0=cx0;
  double y0=cy0;
  double x1=cx0 + cx1 + cx2+ cx3;
  double y1=cy0 + cy1 + cy2+ cy3;
  double minx=Math.min(x0,x1);
  double miny=Math.min(y0,y1);
  double maxx=Math.max(x0,x1);
  double maxy=Math.max(y0,y1);
  if (cx3 != 0) {
    double t1=-(Math.sqrt(cx2 * cx2 - 3 * cx1 * cx3) + cx2) / (3 * cx3);
    double t2=(Math.sqrt(cx2 * cx2 - 3 * cx1 * cx3) - cx2) / (3 * cx3);
    if (t1 > 0 && t1 < 1) {
      double x=evalX(t1);
      minx=Math.min(x,minx);
      maxx=Math.max(x,maxx);
    }
    if (t2 > 0 && t2 < 1) {
      double x=evalX(t2);
      minx=Math.min(x,minx);
      maxx=Math.max(x,maxx);
    }
  }
  if (cy3 != 0) {
    double t1=-(Math.sqrt(cy2 * cy2 - 3 * cy1 * cy3) + cy2) / (3 * cy3);
    double t2=(Math.sqrt(cy2 * cy2 - 3 * cy1 * cy3) - cy2) / (3 * cy3);
    if (t1 > 0 && t1 < 1) {
      double y=evalY(t1);
      miny=Math.min(y,miny);
      maxy=Math.max(y,maxy);
    }
    if (t2 > 0 && t2 < 1) {
      double y=evalY(t2);
      miny=Math.min(y,miny);
      maxy=Math.max(y,maxy);
    }
  }
  addRect((int)minx - range,(int)miny - range,(int)(maxx + range),(int)(maxy + range));
}

public final void bounds ( int range ) { double x0 = cx0 ; double y0 = cy0 ; double x1 = cx0 + cx1 + cx2 + cx3 ; double y1 = cy0 + cy1 + cy2 + cy3 ; double minx = Math . min ( x0 , x1 ) ; double miny = Math . min ( y0 , y1 ) ; double maxx = Math . max ( x0 , x1 ) ; double maxy = Math . max ( y0 , y1 ) ; if ( cx3 != 0 ) { double t1 = - ( Math . sqrt ( cx2 * cx2 - 3 * cx1 * cx3 ) + cx2 ) / ( 3 * cx3 ) ; double t2 = ( Math . sqrt ( cx2 * cx2 - 3 * cx1 * cx3 ) - cx2 ) / ( 3 * cx3 ) ; if ( t1 > 0 && t1 < 1 ) { double x = evalX ( t1 ) ; minx = Math . min ( x , minx ) ; maxx = Math . max ( x , maxx ) ; } if ( t2 > 0 && t2 < 1 ) { double x = evalX ( t2 ) ; minx = Math . min ( x , minx ) ; maxx = Math . max ( x , maxx ) ; } } if ( cy3 != 0 ) { double t1 = - ( Math . sqrt ( cy2 * cy2 - 3 * cy1 * cy3 ) + cy2 ) / ( 3 * cy3 ) ; double t2 = ( Math . sqrt ( cy2 * cy2 - 3 * cy1 * cy3 ) - cy2 ) / ( 3 * cy3 ) ; if ( t1 > 0 && t1 < 1 ) { double y = evalY ( t1 ) ; miny = Math . min ( y , miny ) ; maxy = Math . max ( y , maxy ) ; } if ( t2 > 0 && t2 < 1 ) { double y = evalY ( t2 ) ; miny = Math . min ( y , miny ) ; maxy = Math . max ( y , maxy ) ; } } addRect ( ( int ) minx - range , ( int ) miny - range , ( int ) ( maxx + range ) , ( int ) ( maxy + range ) ) ; }
bounds is calculated by starting and ending point solve ( diff dx / dt = = 0 , t ) and solve ( diff dy / dt = = 0 , t )
