private void bbox(final Rectangle2D r,
        final AffineTransform af, final double length, final double rot) {
      double pos = 0.0;
      final double end = Math.max(length - segLen * 0.5, 0.0);
      while(pos <= end) {
        final AffineTransform at = new AffineTransform(af);
        final Shape s;
        if(isFirst && pos == 0.0) {
          s = pen.getBoundingBox(Pen.SEG_START, rot);
        } else if(isLast && pos + segLen > end) {
          s = pen.getBoundingBox(Pen.SEG_END, rot);
        } else {
          s = pen.getBoundingBox(Pen.SEG_NORM, rot);
        }
        unite(r, transform(at, s));
        pos += segLen;
        af.translate(segLen, 0.0);
      }
    }