/** Given a quadratic equation Ax^2 + Bx + C = 0, return 0, 1, 2 roots for the equation.
*/ int SkFindUnitQuadRoots(SkScalar A, SkScalar B, SkScalar C, SkScalar roots[2]);
/** Measures the angle between two vectors, in the range [0, pi].
*/ float SkMeasureAngleBetweenVectors(SkVector, SkVector);
/** Returns a new, arbitrarily scaled vector that bisects the given vectors. The returned bisector willalwayspointtowardtheinterioroftheprovidedvectors.
*/
SkVector SkFindBisector(SkVector, SkVector);
/** Set pt to the point on the src quadratic specified by t. t must be 0<=t<=1.0
*/ void SkEvalQuadAt(const SkPoint src[3], SkScalar t, SkPoint* pt, SkVector* tangent = nullptr);
/** Given a src quadratic bezier, chop it at the specified t value, where0<t<1,andreturnthetwonewquadraticsindst: dst[0..2]anddst[2..4]
*/ void SkChopQuadAt(const SkPoint src[3], SkPoint dst[5], SkScalar t);
/** Given a src quadratic bezier, chop it at the specified t == 1/2, Thenewquadsarereturnedindst[0..2]anddst[2..4]
*/ void SkChopQuadAtHalf(const SkPoint src[3], SkPoint dst[5]);
/** Measures the rotation of the given quadratic curve in radians.
/** Given a src quadratic bezier, returns the T value whose tangent angle is halfway between the tangentsatp0andp3.
*/ float SkFindQuadMidTangent(const SkPoint src[3]);
/** Given a src quadratic bezier, chop it at the tangent whose angle is halfway between the tangentsatp0andp2.Thenewquadsarereturnedindst[0..2]anddst[2..4].
*/ inlinevoid SkChopQuadAtMidTangent(const SkPoint src[3], SkPoint dst[5]) {
SkChopQuadAt(src, dst, SkFindQuadMidTangent(src));
}
/** Given the 3 coefficients for a quadratic bezier (either X or Y values), look forextrema,andreturnthenumberoft-valuesthatarefoundthatrepresent theseextrema.Ifthequadratichasnoextremabetwee(0..1)exclusive,the functionreturns0. ReturnedcounttValues[] 0ignored 10<tValues[0]<1
*/ int SkFindQuadExtrema(SkScalar a, SkScalar b, SkScalar c, SkScalar tValues[1]);
/** Given 3 points on a quadratic bezier, chop it into 1, 2 beziers such that theresultingbeziersaremonotonicinY.Thisiscalledbythescanconverter. Dependingonwhatisreturned,dst[]istreatedasfollows 0dst[0..2]istheoriginalquad 1dst[0..2]anddst[2..4]arethetwonewquads
*/ int SkChopQuadAtYExtrema(const SkPoint src[3], SkPoint dst[5]); int SkChopQuadAtXExtrema(const SkPoint src[3], SkPoint dst[5]);
/** Given 3 points on a quadratic bezier, if the point of maximum curvatureexistsonthesegment,returnsthetvalueforthis pointalongthecurve.Otherwiseitwillreturnavalueof0.
*/
SkScalar SkFindQuadMaxCurvature(const SkPoint src[3]);
/** Given 3 points on a quadratic bezier, divide it into 2 quadratics ifthepointofmaximumcurvatureexistsonthequadsegment. Dependingonwhatisreturned,dst[]istreatedasfollows 1dst[0..2]istheoriginalquad 2dst[0..2]anddst[2..4]arethetwonewquads Ifdst==null,itisignoredandonlythecountisreturned.
*/ int SkChopQuadAtMaxCurvature(const SkPoint src[3], SkPoint dst[5]);
/** Given 3 points on a quadratic bezier, use degree elevation to convertitintothecubicfittingthesamecurve.Thenewcubic curveisreturnedindst[0..3].
*/ void SkConvertQuadToCubic(const SkPoint src[3], SkPoint dst[4]);
/** Set pt to the point on the src cubic specified by t. t must be 0<=t<=1.0
*/ void SkEvalCubicAt(const SkPoint src[4], SkScalar t, SkPoint* locOrNull,
SkVector* tangentOrNull, SkVector* curvatureOrNull);
/** Given a src cubic bezier, chop it at the specified t value, where0<=t<=1,andreturnthetwonewcubicsindst: dst[0..3]anddst[3..6]
*/ void SkChopCubicAt(const SkPoint src[4], SkPoint dst[7], SkScalar t);
/** Given a src cubic bezier, chop it at the specified t0 and t1 values, where0<=t0<=t1<=1,andreturnthethreenewcubicsindst: dst[0..3],dst[3..6],anddst[6..9]
*/ void SkChopCubicAt(const SkPoint src[4], SkPoint dst[10], float t0, float t1);
/** Given a src cubic bezier, chop it at the specified t values, where0<=t0<=t1<=...<=1,andreturnthenewcubicsindst: dst[0..3],dst[3..6],...,dst[3*t_count..3*(t_count+1)]
*/ void SkChopCubicAt(const SkPoint src[4], SkPoint dst[], const SkScalar t[], int t_count);
/** Given a src cubic bezier, chop it at the specified t == 1/2, Thenewcubicsarereturnedindst[0..3]anddst[3..6]
*/ void SkChopCubicAtHalf(const SkPoint src[4], SkPoint dst[7]);
/** Given a cubic curve with no inflection points, this method measures the rotation in radians.
/** Given a src cubic bezier, returns the T value whose tangent angle is halfway between the tangentsatp0andp3.
*/ float SkFindCubicMidTangent(const SkPoint src[4]);
/** Given a src cubic bezier, chop it at the tangent whose angle is halfway between the tangentsatp0andp3.Thenewcubicsarereturnedindst[0..3]anddst[3..6].
/** Given the 4 coefficients for a cubic bezier (either X or Y values), look forextrema,andreturnthenumberoft-valuesthatarefoundthatrepresent theseextrema.Ifthecubichasnoextremabetwee(0..1)exclusive,the functionreturns0. ReturnedcounttValues[] 0ignored 10<tValues[0]<1 20<tValues[0]<tValues[1]<1
*/ int SkFindCubicExtrema(SkScalar a, SkScalar b, SkScalar c, SkScalar d,
SkScalar tValues[2]);
/** Given 4 points on a cubic bezier, chop it into 1, 2, 3 beziers such that theresultingbeziersaremonotonicinY.Thisiscalledbythescanconverter. Dependingonwhatisreturned,dst[]istreatedasfollows 0dst[0..3]istheoriginalcubic 1dst[0..3]anddst[3..6]arethetwonewcubics 2dst[0..3],dst[3..6],dst[6..9]arethethreenewcubics Ifdst==null,itisignoredandonlythecountisreturned.
*/ int SkChopCubicAtYExtrema(const SkPoint src[4], SkPoint dst[10]); int SkChopCubicAtXExtrema(const SkPoint src[4], SkPoint dst[10]);
/** Given a cubic bezier, return 0, 1, or 2 t-values that represent the inflectionpoints.
*/ int SkFindCubicInflections(const SkPoint src[4], SkScalar tValues[2]);
/** Return 1 for no chop, 2 for having chopped the cubic at a single inflectionpoint,3forhavingchoppedat2inflectionpoints. dstwillholdtheresulting1,2,or3cubics.
*/ int SkChopCubicAtInflections(const SkPoint src[4], SkPoint dst[10]);
int SkFindCubicMaxCurvature(const SkPoint src[4], SkScalar tValues[3]); int SkChopCubicAtMaxCurvature(const SkPoint src[4], SkPoint dst[13],
SkScalar tValues[3] = nullptr); /** Returns t value of cusp if cubic has one; returns -1 otherwise.
*/
SkScalar SkFindCubicCusp(const SkPoint src[4]);
/** Given a monotonically increasing or decreasing cubic bezier src, chop it *wheretheXvalueisthespecifiedvalue.Thereturnedcubicswillbein *dst,sharingthemiddlepoint.Thatis,thefirstcubicisdst[0..3]and *theseconddst[3..6]. * *Ifthecubicprovidedis*not*monotone,itwillbechoppedatthefirst *timethecurvehasthespecifiedXvalue. * *Ifthecubicneverreachesthespecifiedvalue,thefunctionreturnsfalse.
*/ bool SkChopMonoCubicAtX(const SkPoint src[4], SkScalar x, SkPoint dst[7]);
/** Given a monotonically increasing or decreasing cubic bezier src, chop it *wheretheYvalueisthespecifiedvalue.Thereturnedcubicswillbein *dst,sharingthemiddlepoint.Thatis,thefirstcubicisdst[0..3]and *theseconddst[3..6]. * *Ifthecubicprovidedis*not*monotone,itwillbechoppedatthefirst *timethecurvehasthespecifiedYvalue. * *Ifthecubicneverreachesthespecifiedvalue,thefunctionreturnsfalse.
*/ bool SkChopMonoCubicAtY(const SkPoint src[4], SkScalar y, SkPoint dst[7]);
enumclass SkCubicType {
kSerpentine,
kLoop,
kLocalCusp, // Cusp at a non-infinite parameter value with an inflection at t=infinity.
kCuspAtInfinity, // Cusp with a cusp at t=infinity and a local inflection.
kQuadratic,
kLineOrPoint
};
staticinlinebool SkCubicIsDegenerate(SkCubicType type) { switch (type) { case SkCubicType::kSerpentine: case SkCubicType::kLoop: case SkCubicType::kLocalCusp: case SkCubicType::kCuspAtInfinity: returnfalse; case SkCubicType::kQuadratic: case SkCubicType::kLineOrPoint: return true;
}
SK_ABORT("Invalid SkCubicType");
}
staticinlineconstchar* SkCubicTypeName(SkCubicType type) { switch (type) { case SkCubicType::kSerpentine: return"kSerpentine"; case SkCubicType::kLoop: return"kLoop"; case SkCubicType::kLocalCusp: return"kLocalCusp"; case SkCubicType::kCuspAtInfinity: return"kCuspAtInfinity"; case SkCubicType::kQuadratic: return"kQuadratic"; case SkCubicType::kLineOrPoint: return"kLineOrPoint";
}
SK_ABORT("Invalid SkCubicType");
}
/** Find the parameter value where the conic takes on its maximum curvature. * *@paramtoutputscalarformaxcurvature.Willbeunchangedif *maxcurvatureoutside0..1range. * *@returntrueifmaxcurvaturefoundinside0..1range,falseotherwise
*/ // bool findMaxCurvature(SkScalar* t) const; // unimplemented
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.