double x = inx.get(i);
double y = iny.get(i);
if(x >= nextx) {
double bucketx = bucket * scale + offset;
flushBucket(output, bucketx, firsty, r, oldy, bucketSize);
r.clear();
bucket = (int) ((x - offset) / scale);
nextx = (bucket + 1) * scale + offset;
bucketSize = 0;
firsty = y;
if(!Double.isNaN(y)) {