Package icyllis.arc3d.core
Class GeometryUtils
java.lang.Object
icyllis.arc3d.core.GeometryUtils
Geometry solvers.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
chopCubicAt
(float[] src, int srcOff, float[] dst, int dstOff, float t) static void
chopCubicAt
(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, float t, float[] dst, int off) static void
chopQuadAt
(float[] src, int srcOff, float[] dst, int dstOff, float t) static void
chopQuadAt
(float x0, float y0, float x1, float y1, float x2, float y2, float t, float[] dst, int off) 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.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.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 countstatic void
eval_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 void
evalCubicAt
(float[] src, int srcOff, float[] dst, int dstOff, float t) static void
evalCubicAt
(float[] src, int srcOff, float t, float[] pos, int posOff, float[] tangent, int tangentOff) static void
evalCubicAt
(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 void
evalCubicAt
(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 void
evalQuadAt
(float[] src, int srcOff, float[] dst, int dstOff, float t) static void
evalQuadAt
(float[] src, int srcOff, float t, float[] pos, int posOff, float[] tangent, int tangentOff) static void
evalQuadAt
(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 void
evalQuadAt
(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 float
findCubicCusp
(float[] src, int off) 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.static int
findCubicInflectionPoints
(float[] src, int srcOff, float[] dst, int dstOff) static int
findCubicInflectionPoints
(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 int
findCubicMaxCurvature
(float[] src, int srcOff, float[] dst, int dstOff) static int
findCubicMaxCurvature
(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 float
findQuadMaxCurvature
(float[] src, int off) 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.static int
findQuadRoots
(float A, float B, float C, float[] roots, int off) static int
findUnitCubicRoots
(float A, float B, float C, float D, float[] roots, int off) static int
findUnitQuadRoots
(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
-