Lines Matching refs:pts
108 SkPoint pts[4];
111 pts[j].set(std::ldexp(1 + rand->nextF(), i), std::ldexp(1 + rand->nextF(), i));
113 f(pts);
123 auto setupCubicLengthTerm = [](int seed, SkPoint pts[], float term) {
124 memset(pts, 0, sizeof(SkPoint) * 4);
142 pts[0] = term2d;
143 pts[3] = term2d * .75f;
146 pts[1] = term2d * -.5f;
149 pts[1] = term2d * -.5f;
152 pts[3] = term2d;
153 pts[0] = term2d * .75f;
161 auto setupQuadraticLengthTerm = [](int seed, SkPoint pts[], float term) {
162 memset(pts, 0, sizeof(SkPoint) * 3);
180 pts[0] = term2d;
183 pts[1] = term2d * -.5f;
186 pts[2] = term2d;
198 SkPoint pts[4];
206 setupCubicLengthTerm(level << 1, pts, x - epsilon);
207 float referenceValue = wangs_formula_cubic_reference_impl(kPrecision, pts);
209 float c = wangs_formula::cubic(kPrecision, pts);
211 REPORTER_ASSERT(r, wangs_formula::cubic_log2(kPrecision, pts) == level);
212 setupCubicLengthTerm(level << 1, pts, x + epsilon);
213 referenceValue = wangs_formula_cubic_reference_impl(kPrecision, pts);
215 c = wangs_formula::cubic(kPrecision, pts);
217 REPORTER_ASSERT(r, wangs_formula::cubic_log2(kPrecision, pts) == level + 1);
225 setupQuadraticLengthTerm(level << 1, pts, x - epsilon);
226 float referenceValue = wangs_formula_quadratic_reference_impl(kPrecision, pts);
228 float q = wangs_formula::quadratic(kPrecision, pts);
230 REPORTER_ASSERT(r, wangs_formula::quadratic_log2(kPrecision, pts) == level);
231 setupQuadraticLengthTerm(level << 1, pts, x + epsilon);
232 referenceValue = wangs_formula_quadratic_reference_impl(kPrecision, pts);
234 q = wangs_formula::quadratic(kPrecision, pts);
236 REPORTER_ASSERT(r, wangs_formula::quadratic_log2(kPrecision, pts) == level + 1);
240 auto check_cubic_log2 = [&](const SkPoint* pts) {
241 float f = std::max(1.f, wangs_formula_cubic_reference_impl(kPrecision, pts));
242 int f_log2 = wangs_formula::cubic_log2(kPrecision, pts);
244 float c = std::max(1.f, wangs_formula::cubic(kPrecision, pts));
248 auto check_quadratic_log2 = [&](const SkPoint* pts) {
249 float f = std::max(1.f, wangs_formula_quadratic_reference_impl(kPrecision, pts));
250 int f_log2 = wangs_formula::quadratic_log2(kPrecision, pts);
252 float q = std::max(1.f, wangs_formula::quadratic(kPrecision, pts));
259 SkPoint pts[4];
260 m.mapPoints(pts, kSerp, 4);
261 check_cubic_log2(pts);
263 m.mapPoints(pts, kLoop, 4);
264 check_cubic_log2(pts);
266 m.mapPoints(pts, kQuad, 3);
267 check_quadratic_log2(pts);
270 for_random_beziers(4, &rand, [&](const SkPoint pts[]) {
271 check_cubic_log2(pts);
274 for_random_beziers(3, &rand, [&](const SkPoint pts[]) {
275 check_quadratic_log2(pts);
281 auto check_cubic_log2_with_transform = [&](const SkPoint* pts, const SkMatrix& m){
283 m.mapPoints(ptsXformed, pts, 4);
285 int actual = wangs_formula::cubic_log2(kPrecision, pts, wangs_formula::VectorXform(m));
289 auto check_quadratic_log2_with_transform = [&](const SkPoint* pts, const SkMatrix& m) {
291 m.mapPoints(ptsXformed, pts, 3);
293 int actual = wangs_formula::quadratic_log2(kPrecision, pts, wangs_formula::VectorXform(m));
304 for_random_beziers(4, &rand, [&](const SkPoint pts[]) {
305 check_cubic_log2_with_transform(pts, m);
308 for_random_beziers(3, &rand, [&](const SkPoint pts[]) {
309 check_quadratic_log2_with_transform(pts, m);
329 auto check_worst_case_cubic = [&](const SkPoint* pts) {
331 bbox.setBoundsNoCheck(pts, 4);
335 float actual = wangs_formula_cubic_reference_impl(kPrecision, pts);
341 for_random_beziers(4, &rand, [&](const SkPoint pts[]) {
342 check_worst_case_cubic(pts);
358 for_random_beziers(3, &rand, [&r](const SkPoint pts[]) {
360 std::ceil(wangs_formula_quadratic_reference_impl(kPrecision, pts)));
372 sectionPts = pts;
374 SkChopQuadAt(pts, tmp0, tmax);
378 SkChopQuadAt(pts, tmp0, tmin);
409 for_random_beziers(3, &rand, [&r](const SkPoint pts[]) {
410 const float rational_nsegs = wangs_formula::conic(kPrecision, pts, 1.f);
411 const float integral_nsegs = wangs_formula_quadratic_reference_impl(kPrecision, pts);
425 const auto eval_conic = [](const SkPoint pts[3], float w, float t) -> Sk2d {
430 const Sk2d p0 = {pts[0].fX, pts[0].fY};
431 const Sk2d p1 = {pts[1].fX, pts[1].fY};
433 const Sk2d p2 = {pts[2].fX, pts[2].fY};
454 [&](const SkPoint pts[]) {
455 const int nsegs = SkScalarCeilToInt(wangs_formula::conic(kPrecision, pts, w));
463 p0 = eval_conic(pts, w, tmin);
464 p1 = eval_conic(pts, w, tmid);
465 p2 = eval_conic(pts, w, tmax);
485 for_random_beziers(3, &rand, [&r, w](const SkPoint pts[]) {
486 const float ref_nsegs = wangs_formula_conic_reference_impl(kPrecision, pts, w);
487 const float nsegs = wangs_formula::conic(kPrecision, pts, w);
499 auto check_conic_with_transform = [&](const SkPoint* pts, float w, const SkMatrix& m) {
501 m.mapPoints(ptsXformed, pts, 3);
503 float actual = wangs_formula::conic(kPrecision, pts, w, wangs_formula::VectorXform(m));
510 for_random_beziers(3, &rand, [&](const SkPoint pts[]) {
511 check_conic_with_transform(pts, w, SkMatrix::I());
513 pts, w, SkMatrix::Scale(rand.nextRangeF(-10, 10), rand.nextRangeF(-10, 10)));
521 check_conic_with_transform(pts, w, m);