public static Rect addMiterLimitStrokeToBounds(ShapeRecord segment1,ShapeRecord segment2,double miterLimit,double halfWeight,Rect pathBBox,int xPrev,int yPrev,int x,int y){
  Point jointPoint=new Point(x,y);
  if (isInnerJoint(jointPoint,pathBBox,miterLimit,halfWeight)) {
    return pathBBox;
  }
  Point t0=getTangent(segment1,false,xPrev,yPrev);
  Point t1=getTangent(segment2,true,x,y);
  if (getPointLength(t0) == 0 || getPointLength(t1) == 0) {
    return pathBBox;
  }
  t0=normalize(t0,1);
  t0.x=-t0.x;
  t0.y=-t0.y;
  t1=normalize(t1,1);
  Point halfT0T1=new Point((t1.x - t0.x) * 0.5,(t1.y - t0.y) * 0.5);
  double sinHalfAlpha=getPointLength(halfT0T1);
  if (Math.abs(sinHalfAlpha) < 1.0E-9) {
    return pathBBox;
  }
  Point bisect=new Point(-0.5 * (t0.x + t1.x),-0.5 * (t0.y + t1.y));
  double bisectLength=getPointLength(bisect);
  if (bisectLength == 0) {
    return pathBBox;
  }
  Rect newRect=pathBBox;
  if (sinHalfAlpha == 0 || miterLimit < 1 / sinHalfAlpha) {
    bisect=normalize(bisect,1);
    halfT0T1=normalize(halfT0T1,(halfWeight - miterLimit * halfWeight * sinHalfAlpha) / bisectLength);
    Point pt0=new Point(jointPoint.x + miterLimit * halfWeight * bisect.x + halfT0T1.x,jointPoint.y + miterLimit * halfWeight * bisect.y + halfT0T1.y);
    Point pt1=new Point(jointPoint.x + miterLimit * halfWeight * bisect.x - halfT0T1.x,jointPoint.y + miterLimit * halfWeight * bisect.y - halfT0T1.y);
    newRect=rectUnion((int)StrictMath.rint(pt0.x),(int)StrictMath.rint(pt0.y),(int)StrictMath.rint(pt0.x),(int)StrictMath.rint(pt0.y),newRect);
    newRect=rectUnion((int)StrictMath.rint(pt1.x),(int)StrictMath.rint(pt1.y),(int)StrictMath.rint(pt1.x),(int)StrictMath.rint(pt1.y),newRect);
  }
 else {
    bisect=normalize(bisect,1);
    Point strokeTip=new Point(jointPoint.x + bisect.x * halfWeight / sinHalfAlpha,jointPoint.y + bisect.y * halfWeight / sinHalfAlpha);
    newRect=rectUnion((int)StrictMath.rint(strokeTip.x),(int)StrictMath.rint(strokeTip.y),(int)StrictMath.rint(strokeTip.x),(int)StrictMath.rint(strokeTip.y),newRect);
  }
  return newRect;
}

public static Rect addMiterLimitStrokeToBounds ( ShapeRecord segment1 , ShapeRecord segment2 , double miterLimit , double halfWeight , Rect pathBBox , int xPrev , int yPrev , int x , int y ) { Point jointPoint = new Point ( x , y ) ; if ( isInnerJoint ( jointPoint , pathBBox , miterLimit , halfWeight ) ) { return pathBBox ; } Point t0 = getTangent ( segment1 , false , xPrev , yPrev ) ; Point t1 = getTangent ( segment2 , true , x , y ) ; if ( getPointLength ( t0 ) == 0 || getPointLength ( t1 ) == 0 ) { return pathBBox ; } t0 = normalize ( t0 , 1 ) ; t0 . x = - t0 . x ; t0 . y = - t0 . y ; t1 = normalize ( t1 , 1 ) ; Point halfT0T1 = new Point ( ( t1 . x - t0 . x ) * 0.5 , ( t1 . y - t0 . y ) * 0.5 ) ; double sinHalfAlpha = getPointLength ( halfT0T1 ) ; if ( Math . abs ( sinHalfAlpha ) < 1.0E-9 ) { return pathBBox ; } Point bisect = new Point ( - 0.5 * ( t0 . x + t1 . x ) , - 0.5 * ( t0 . y + t1 . y ) ) ; double bisectLength = getPointLength ( bisect ) ; if ( bisectLength == 0 ) { return pathBBox ; } Rect newRect = pathBBox ; if ( sinHalfAlpha == 0 || miterLimit < 1 / sinHalfAlpha ) { bisect = normalize ( bisect , 1 ) ; halfT0T1 = normalize ( halfT0T1 , ( halfWeight - miterLimit * halfWeight * sinHalfAlpha ) / bisectLength ) ; Point pt0 = new Point ( jointPoint . x + miterLimit * halfWeight * bisect . x + halfT0T1 . x , jointPoint . y + miterLimit * halfWeight * bisect . y + halfT0T1 . y ) ; Point pt1 = new Point ( jointPoint . x + miterLimit * halfWeight * bisect . x - halfT0T1 . x , jointPoint . y + miterLimit * halfWeight * bisect . y - halfT0T1 . y ) ; newRect = rectUnion ( ( int ) StrictMath . rint ( pt0 . x ) , ( int ) StrictMath . rint ( pt0 . y ) , ( int ) StrictMath . rint ( pt0 . x ) , ( int ) StrictMath . rint ( pt0 . y ) , newRect ) ; newRect = rectUnion ( ( int ) StrictMath . rint ( pt1 . x ) , ( int ) StrictMath . rint ( pt1 . y ) , ( int ) StrictMath . rint ( pt1 . x ) , ( int ) StrictMath . rint ( pt1 . y ) , newRect ) ; } else { bisect = normalize ( bisect , 1 ) ; Point strokeTip = new Point ( jointPoint . x + bisect . x * halfWeight / sinHalfAlpha , jointPoint . y + bisect . y * halfWeight / sinHalfAlpha ) ; newRect = rectUnion ( ( int ) StrictMath . rint ( strokeTip . x ) , ( int ) StrictMath . rint ( strokeTip . y ) , ( int ) StrictMath . rint ( strokeTip . x ) , ( int ) StrictMath . rint ( strokeTip . y ) , newRect ) ; } return newRect ; }
adds the miter limit stroke to bounds .
