1

I am writing my own PathIterator implementation.

Currently I implemented method with flatness with flatness-less one:

@Override
public PathIterator getPathIterator(AffineTransform at, double flatness) {
    return getPathIterator(at);
}

i.e. I am ignoring it.

What is the simplest way to work with flatness parameter?

My current iterator gives a series of parallel vertical lines (not connected between). How important for me to implement flatness-aware version of the iterator? Where is it used?

Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385

1 Answers1

3

The getPathIterator() cited should return only SEG_MOVETO, SEG_LINETO, and SEG_CLOSE segment types. If your Shape has no other segment types, e.g. SEG_CUBICTO or SEG_QUADTO, the flatness is irrelevant. As a concrete example, the Rectangle2D implementation specifies that "Since rectangles are already flat, the flatness parameter is ignored."

trashgod
  • 203,806
  • 29
  • 246
  • 1,045