Package icyllis.arc3d.sketch
Class GeometryUtils
java.lang.Object
icyllis.arc3d.sketch.GeometryUtils
Geometry solvers.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidchopCubicAt(float[] src, int srcOff, float[] dst, int dstOff, float t) static voidchopCubicAt(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, float t, float[] dst, int off) static voidchopQuadAt(float[] src, int srcOff, float[] dst, int dstOff, float t) static voidchopQuadAt(float x0, float y0, float x1, float y1, float x2, float y2, float t, float[] dst, int off) static intcomputeConicToQuads(float x0, float y0, float x1, float y1, float x2, float y2, float w1, float[] dst, int off, int level) Chop the conic into N quads, stored continuously in dst, where N = 1 invalid input: '<'invalid input: '<' level.static intcomputeConicToQuadsLevel(float x0, float y0, float x1, float y1, float x2, float y2, float w1, float tol) Return the log2 number of quadratic Bézier curves needed to approximate the conic with a sequence of quadratic Bézier curves.static intdeduplicate_pairs(float[] arr, int off, int count) Given an array and count, remove all pair-wise duplicates from the array, keeping the existing sorting, and return the new countstatic voideval_cubic_derivative(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, float t, float[] dst, int off) static voidevalCubicAt(float[] src, int srcOff, float[] dst, int dstOff, float t) static voidevalCubicAt(float[] src, int srcOff, float t, float[] pos, int posOff, float[] tangent, int tangentOff) static voidevalCubicAt(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, float t, float[] dst, int off) t must be 0 invalid input: '<'= t invalid input: '<'= 1.0static voidevalCubicAt(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, float t, float[] pos, int posOff, float[] tangent, int tangentOff) t must be 0 invalid input: '<'= t invalid input: '<'= 1.0; tangent vector is not normalizedstatic voidevalQuadAt(float[] src, int srcOff, float[] dst, int dstOff, float t) static voidevalQuadAt(float[] src, int srcOff, float t, float[] pos, int posOff, float[] tangent, int tangentOff) static voidevalQuadAt(float x0, float y0, float x1, float y1, float x2, float y2, float t, float[] dst, int off) t must be 0 invalid input: '<'= t invalid input: '<'= 1.0static voidevalQuadAt(float x0, float y0, float x1, float y1, float x2, float y2, float t, float[] pos, int posOff, float[] tangent, int tangentOff) t must be 0 invalid input: '<'= t invalid input: '<'= 1.0; tangent vector is not normalizedstatic floatfindCubicCusp(float[] src, int off) static floatfindCubicCusp(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3) Returns t value of cusp if cubic has one; returns -1 otherwise.static intfindCubicInflectionPoints(float[] src, int srcOff, float[] dst, int dstOff) static intfindCubicInflectionPoints(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, float[] roots, int off) Given a cubic bezier, return 0, 1, or 2 t-values that represent the inflection points.static intfindCubicMaxCurvature(float[] src, int srcOff, float[] dst, int dstOff) static intfindCubicMaxCurvature(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, float[] roots, int off) Returns 1, 2 or 3 t-values.static floatfindQuadMaxCurvature(float[] src, int off) static floatfindQuadMaxCurvature(float x0, float y0, float x1, float y1, float x2, float y2) Given 3 points on a quadratic bezier, if the point of maximum curvature exists on the segment, returns the t value for this point along the curve.static intfindQuadRoots(float A, float B, float C, float[] roots, int off) static intfindUnitCubicRoots(float A, float B, float C, float D, float[] roots, int off) static intfindUnitQuadRoots(float A, float B, float C, float[] roots, int off)
-
Field Details
-
MAX_CONIC_TO_QUADS_LEVEL
public static final int MAX_CONIC_TO_QUADS_LEVEL- See Also:
-
-
Constructor Details
-
GeometryUtils
protected GeometryUtils()
-
-
Method Details
-
findQuadRoots
public static int findQuadRoots(float A, float B, float C, float[] roots, int off) -
findUnitQuadRoots
public static int findUnitQuadRoots(float A, float B, float C, float[] roots, int off) -
findQuadMaxCurvature
-
findQuadMaxCurvature
public static float findQuadMaxCurvature(float x0, float y0, float x1, float y1, float x2, float y2) Given 3 points on a quadratic bezier, if the point of maximum curvature exists on the segment, returns the t value for this point along the curve. Otherwise it will return a value of 0. -
evalQuadAt
-
evalQuadAt
public static void evalQuadAt(float x0, float y0, float x1, float y1, float x2, float y2, float t, @Size(min=2L) float[] dst, int off) t must be 0 invalid input: '<'= t invalid input: '<'= 1.0 -
evalQuadAt
-
evalQuadAt
public static void evalQuadAt(float x0, float y0, float x1, float y1, float x2, float y2, float t, @Size(min=2L) float[] pos, int posOff, @Size(min=2L) float[] tangent, int tangentOff) t must be 0 invalid input: '<'= t invalid input: '<'= 1.0; tangent vector is not normalized -
chopQuadAt
-
chopQuadAt
-
findCubicInflectionPoints
-
findCubicInflectionPoints
public static int findCubicInflectionPoints(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, @Size(min=2L) float[] roots, int off) Given a cubic bezier, return 0, 1, or 2 t-values that represent the inflection points. -
evalCubicAt
-
evalCubicAt
public static void evalCubicAt(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, float t, @Size(min=2L) float[] dst, int off) t must be 0 invalid input: '<'= t invalid input: '<'= 1.0 -
evalCubicAt
-
evalCubicAt
public static void evalCubicAt(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, float t, @Size(min=2L) float[] pos, int posOff, @Size(min=2L) float[] tangent, int tangentOff) t must be 0 invalid input: '<'= t invalid input: '<'= 1.0; tangent vector is not normalized -
eval_cubic_derivative
-
chopCubicAt
-
chopCubicAt
-
deduplicate_pairs
public static int deduplicate_pairs(float[] arr, int off, int count) Given an array and count, remove all pair-wise duplicates from the array, keeping the existing sorting, and return the new count -
findUnitCubicRoots
public static int findUnitCubicRoots(float A, float B, float C, float D, float[] roots, int off) -
findCubicMaxCurvature
-
findCubicMaxCurvature
public static int findCubicMaxCurvature(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, @Size(min=3L) float[] roots, int off) Returns 1, 2 or 3 t-values. -
findCubicCusp
-
findCubicCusp
public static float findCubicCusp(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3) Returns t value of cusp if cubic has one; returns -1 otherwise. -
computeConicToQuadsLevel
public static int computeConicToQuadsLevel(float x0, float y0, float x1, float y1, float x2, float y2, float w1, float tol) Return the log2 number of quadratic Bézier curves needed to approximate the conic with a sequence of quadratic Bézier curves. Will be 0 to 5. -
computeConicToQuads
public static int computeConicToQuads(float x0, float y0, float x1, float y1, float x2, float y2, float w1, float[] dst, int off, int level) Chop the conic into N quads, stored continuously in dst, where N = 1 invalid input: '<'invalid input: '<' level. The amount of storage needed is (4 * N + 2)- Parameters:
w1- conic weightlevel- 0 to 5 (1 to 32 quad curves)- Returns:
- actual number of quad curves
-