Lines Matching refs:cubic

60     // note that three points in a line doesn't simplify a cubic
109 static int coincident_line(const SkDCubic& cubic, SkDCubic& reduction) {
110 reduction[0] = reduction[1] = cubic[0];
118 static int vertical_line(const SkDCubic& cubic, SkDCubic& reduction) {
119 reduction[0] = cubic[0];
120 reduction[1] = cubic[3];
124 static int horizontal_line(const SkDCubic& cubic, SkDCubic& reduction) {
125 reduction[0] = cubic[0];
126 reduction[1] = cubic[3];
131 static int check_quadratic(const SkDCubic& cubic, SkDCubic& reduction) {
132 double dx10 = cubic[1].fX - cubic[0].fX;
133 double dx23 = cubic[2].fX - cubic[3].fX;
134 double midX = cubic[0].fX + dx10 * 3 / 2;
135 double sideAx = midX - cubic[3].fX;
141 double dy10 = cubic[1].fY - cubic[0].fY;
142 double dy23 = cubic[2].fY - cubic[3].fY;
143 double midY = cubic[0].fY + dy10 * 3 / 2;
144 double sideAy = midY - cubic[3].fY;
150 reduction[0] = cubic[0];
153 reduction[2] = cubic[3];
157 static int check_linear(const SkDCubic& cubic,
161 while (cubic[startIndex].approximatelyEqual(cubic[endIndex])) {
168 if (!cubic.isLinear(startIndex, endIndex)) {
172 reduction[0] = cubic[0];
173 reduction[1] = cubic[3];
178 http://objectmix.com/graphics/132906-fast-precision-driven-cubic-quadratic-piecewise-degree-reduction-algos-2-a.html
180 Given points c1, c2, c3 and c4 of a cubic Bezier, the points of the
200 // note that three points in a line doesn't simplify a cubic
203 int SkReduceOrder::reduce(const SkDCubic& cubic, Quadratics allowQuadratics) {
209 if (cubic[minX].fX > cubic[index].fX) {
212 if (cubic[minY].fY > cubic[index].fY) {
215 if (cubic[maxX].fX < cubic[index].fX) {
218 if (cubic[maxY].fY < cubic[index].fY) {
223 double cx = cubic[index].fX;
224 double cy = cubic[index].fY;
226 SkTMax(fabs(cubic[minX].fX), fabs(cubic[minY].fY))));
233 if (approximately_equal_half(cx * inv, cubic[minX].fX * inv)) {
236 if (approximately_equal_half(cy * inv, cubic[minY].fY * inv)) {
242 return coincident_line(cubic, fCubic);
244 return vertical_line(cubic, fCubic);
247 return horizontal_line(cubic, fCubic);
249 int result = check_linear(cubic, minX, maxX, minY, maxY, fCubic);
254 && (result = check_quadratic(cubic, fCubic))) {
257 fCubic = cubic;
275 SkDCubic cubic;
276 cubic.set(a);
278 int order = reducer.reduce(cubic, kAllow_Quadratics);
279 if (order == 2 || order == 3) { // cubic became line or quad