Package icyllis.arc3d.engine
Class PathUtils
java.lang.Object
icyllis.arc3d.engine.PathUtils
Tessellate paths.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final float
static final int
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
countCubicPoints
(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, float tol) Returns the maximum number of points required when using a recursive chopping algorithm to linearize the cubic Bezier to the given error tolerance.static int
countQuadraticPoints
(float x0, float y0, float x1, float y1, float x2, float y2, float tol) Returns the maximum number of points required when using a recursive chopping algorithm to linearize the quadratic Bezier to the given error tolerance.static int
generateCubicPoints
(float p0x, float p0y, float p1x, float p1y, float p2x, float p2y, float p3x, float p3y, float tolSq, float[] dst, int off, int rem) Tessellate, dst holds repeated x and y coordinates.static int
generateQuadraticPoints
(float p0x, float p0y, float p1x, float p1y, float p2x, float p2y, float tolSq, float[] dst, int off, int rem) Tessellate, dst holds repeated x and y coordinates.
-
Field Details
-
DEFAULT_TOLERANCE
public static final float DEFAULT_TOLERANCE- See Also:
-
MAX_CHOPS_PER_CURVE
public static final int MAX_CHOPS_PER_CURVE- See Also:
-
MAX_POINTS_PER_CURVE
public static final int MAX_POINTS_PER_CURVE- See Also:
-
-
Constructor Details
-
PathUtils
protected PathUtils()
-
-
Method Details
-
countQuadraticPoints
public static int countQuadraticPoints(float x0, float y0, float x1, float y1, float x2, float y2, float tol) Returns the maximum number of points required when using a recursive chopping algorithm to linearize the quadratic Bezier to the given error tolerance. This is a power of two and will not exceedMAX_POINTS_PER_CURVE
.- See Also:
-
generateQuadraticPoints
public static int generateQuadraticPoints(float p0x, float p0y, float p1x, float p1y, float p2x, float p2y, float tolSq, float[] dst, int off, int rem) Tessellate, dst holds repeated x and y coordinates. Note: off and rem are in floats, not in points (x,y). Return value is also in floats.- Parameters:
tolSq
- square of toleranceoff
- starting index in dstrem
- max number of point coordinates- Returns:
- actual number of point coordinates
-
countCubicPoints
public static int countCubicPoints(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, float tol) Returns the maximum number of points required when using a recursive chopping algorithm to linearize the cubic Bezier to the given error tolerance. This is a power of two and will not exceedMAX_POINTS_PER_CURVE
.- See Also:
-
generateCubicPoints
public static int generateCubicPoints(float p0x, float p0y, float p1x, float p1y, float p2x, float p2y, float p3x, float p3y, float tolSq, float[] dst, int off, int rem) Tessellate, dst holds repeated x and y coordinates. Note: off and rem are in floats, not in points (x,y). Return value is also in floats.- Parameters:
tolSq
- square of toleranceoff
- starting index in dstrem
- max number of point coordinates- Returns:
- actual number of point coordinates
-