public class SimpleOrTesselatingVisitor extends SimplePathVisitor
This checks every corner and if it has the same sign and total curvature is 2π, we know the polygon is convex. Once we get to the end, we draw it. If it's not convex, then we fall back to tesselating it.
There are many places where we could fail being a simple convex polygon and then have to fail over to the tesselator. As soon as we fail over we need to catch the tesselator up to the current position and then use the tesselator from then on. For that reason, this class is a little messy.
CURVE_STEPS
Constructor and Description |
---|
SimpleOrTesselatingVisitor(PathVisitor simpleVisitor,
PathVisitor tesselatorVisitor) |
Modifier and Type | Method and Description |
---|---|
void |
beginPoly(int windingRule)
Starts the polygon or polyline.
|
void |
closeLine()
Specifies that the preceding subpath should be closed by appending a line
segment back to the point corresponding to the most recent call to
#moveTo(float[]) . |
void |
endPoly()
Signifies that the polygon or polyline has ended.
|
void |
lineTo(float[] vertex)
Specifies the end point of a line to be drawn from the most recently
specified point.
|
void |
moveTo(float[] vertex)
Specifies the starting location for a new subpath.
|
void |
setGLContext(GL context)
Sets the GL context to be used for the next drawing session.
|
void |
setStroke(BasicStroke stroke)
Sets the stroke to be used when drawing a path.
|
cubicTo, getNumCurveSteps, quadTo, setNumCurveSteps
public SimpleOrTesselatingVisitor(PathVisitor simpleVisitor, PathVisitor tesselatorVisitor)
public void setGLContext(GL context)
PathVisitor
context
- The GL contextpublic void setStroke(BasicStroke stroke)
PathVisitor
public void beginPoly(int windingRule)
PathVisitor
windingRule
- The winding rule for the polygon.public void moveTo(float[] vertex)
PathVisitor
vertex
- An array where the first two values are the x,y coordinates of the
start of the subpath.public void lineTo(float[] vertex)
PathVisitor
vertex
- An array where the first two values are the x,y coordinates of the
next point in the subpath.public void closeLine()
PathVisitor
#moveTo(float[])
.public void endPoly()
PathVisitor
Copyright © 2010-2013. All Rights Reserved.