public class SimplifiedPathIterator extends Objectimplements PathIterator
PathIterator and makes sure that each curve is of the smallest possible degree.
In addition to being more efficient, this can avoid divide-by-zero errors for some operations.
SEG_CLOSE, SEG_CUBICTO, SEG_LINETO, SEG_MOVETO, SEG_QUADTO, WIND_EVEN_ODD, WIND_NON_ZERO| Constructor and Description |
|---|
SimplifiedPathIterator(PathIterator
Creates a new SimplifiedPathIterator that filters the argument.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
collinear(double x1, double y1, double x2, double y2, double x3, double y3)
Returns true if all 3 points are on the same line.
|
int |
currentSegment(double[] f)
|
int |
currentSegment(float[] f)
|
int |
getWindingRule()
|
boolean |
isDone()
|
void |
next()
|
static int |
simplify(int type, double lastX, double lastY, double[] data)
This possibly reduces the degree of a segment, if possible.
|
static int |
simplify(int type, float lastX, float lastY, float[] data)
This possibly reduces the degree of a segment, if possible.
|
public SimplifiedPathIterator(PathIteratori)
i -
public static boolean collinear(double x1,
double y1,
double x2,
double y2,
double x3,
double y3)
x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2)<TOL*TOL
x1 - the x-coordinate of point #1
y1 - the y-coordinate of point #1
x2 - the x-coordinate of point #2
y2 - the y-coordinate of point #2
x3 - the x-coordinate of point #3
y3 - the y-coordinate of point #3
public static int simplify(int type,
float lastX,
float lastY,
float[] data)
type - the current expected type of the segment data
lastX - the previous X value from which this segment begins
lastY - the previous Y value from which this segment begins
data - the data of the current segment.
type argument if nothing was modified.
public static int simplify(int type,
double lastX,
double lastY,
double[] data)
type - the current expected type of the segment data
lastX - the previous X value from which this segment begins
lastY - the previous Y value from which this segment begins
data - the data of the current segment.
type argument if nothing was modified.
public int currentSegment(double[] f)
public int currentSegment(float[] f)
public int getWindingRule()
public boolean isDone()
public void next()