Package icyllis.arc3d.engine

# Class PathUtils

java.lang.Object
icyllis.arc3d.engine.PathUtils

public class PathUtils extends Object
Tessellate paths.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final float`
  `DEFAULT_TOLERANCE`
  `static final int`
  `MAX_CHOPS_PER_CURVE`
  `static final int`
  `MAX_POINTS_PER_CURVE`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `PathUtils()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `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.
  `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.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### DEFAULT_TOLERANCE

    public static final float DEFAULT_TOLERANCE
    See Also:
      - Constant Field Values

  - ### MAX_CHOPS_PER_CURVE

    public static final int MAX_CHOPS_PER_CURVE
    See Also:
      - Constant Field Values

  - ### MAX_POINTS_PER_CURVE

    public static final int MAX_POINTS_PER_CURVE
    See Also:
      - Constant Field Values

- ## 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 exceed `MAX_POINTS_PER_CURVE`.
    See Also:
      - `generateQuadraticPoints(float, float, float, float, float, float, float, float[], int, int)`

  - ### 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 tolerance
      `off` - starting index in dst
      `rem` - 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 exceed `MAX_POINTS_PER_CURVE`.
    See Also:
      - `generateCubicPoints(float, float, float, float, float, float, float, float, float, float[], int, int)`

  - ### 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 tolerance
      `off` - starting index in dst
      `rem` - max number of point coordinates
    Returns:
      actual number of point coordinates