2013-04-08 11:50:00 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2012 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "tests/PathOpsQuadIntersectionTestData.h"
|
2013-04-08 11:50:00 +00:00
|
|
|
|
2016-10-20 15:32:18 +00:00
|
|
|
const QuadPts quadraticPoints[] = {
|
2013-04-08 11:50:00 +00:00
|
|
|
{{{0, 0}, {1, 0}, {0, 0}}},
|
|
|
|
{{{0, 0}, {0, 1}, {0, 0}}},
|
|
|
|
{{{0, 0}, {1, 1}, {0, 0}}},
|
|
|
|
{{{1, 1}, {2, 2}, {1, 1}}},
|
|
|
|
};
|
|
|
|
|
2013-04-15 19:13:59 +00:00
|
|
|
const size_t quadraticPoints_count = SK_ARRAY_COUNT(quadraticPoints);
|
2013-04-08 11:50:00 +00:00
|
|
|
|
2016-10-20 15:32:18 +00:00
|
|
|
const QuadPts quadraticLines[] = {
|
2013-04-08 11:50:00 +00:00
|
|
|
{{{0, 0}, {0, 0}, {1, 0}}},
|
|
|
|
{{{1, 0}, {0, 0}, {0, 0}}},
|
|
|
|
{{{1, 0}, {2, 0}, {3, 0}}},
|
|
|
|
{{{0, 0}, {0, 0}, {0, 1}}},
|
|
|
|
{{{0, 1}, {0, 0}, {0, 0}}},
|
|
|
|
{{{0, 1}, {0, 2}, {0, 3}}},
|
|
|
|
{{{0, 0}, {0, 0}, {1, 1}}},
|
|
|
|
{{{1, 1}, {0, 0}, {0, 0}}},
|
|
|
|
{{{1, 1}, {2, 2}, {3, 3}}},
|
|
|
|
{{{1, 1}, {3, 3}, {3, 3}}},
|
|
|
|
{{{1, 1}, {1, 1}, {2, 2}}},
|
|
|
|
{{{1, 1}, {1, 1}, {3, 3}}},
|
|
|
|
{{{1, 1}, {2, 2}, {4, 4}}}, // no coincident
|
|
|
|
{{{1, 1}, {3, 3}, {4, 4}}},
|
|
|
|
{{{1, 1}, {3, 3}, {2, 2}}},
|
|
|
|
{{{1, 1}, {4, 4}, {2, 2}}},
|
|
|
|
{{{1, 1}, {4, 4}, {3, 3}}},
|
|
|
|
{{{2, 2}, {1, 1}, {3, 3}}},
|
|
|
|
{{{2, 2}, {1, 1}, {4, 4}}},
|
|
|
|
{{{2, 2}, {3, 3}, {1, 1}}},
|
|
|
|
{{{2, 2}, {3, 3}, {4, 4}}},
|
|
|
|
{{{2, 2}, {4, 4}, {1, 1}}},
|
|
|
|
{{{2, 2}, {4, 4}, {3, 3}}},
|
|
|
|
};
|
|
|
|
|
2013-04-15 19:13:59 +00:00
|
|
|
const size_t quadraticLines_count = SK_ARRAY_COUNT(quadraticLines);
|
2013-04-08 11:50:00 +00:00
|
|
|
|
2015-03-26 14:52:43 +00:00
|
|
|
static const double F = FLT_EPSILON * 32;
|
|
|
|
static const double H = FLT_EPSILON * 32;
|
|
|
|
static const double J = FLT_EPSILON * 32;
|
|
|
|
static const double K = FLT_EPSILON * 32; // INVESTIGATE: why are larger multiples necessary?
|
2013-04-08 11:50:00 +00:00
|
|
|
|
2016-10-20 15:32:18 +00:00
|
|
|
const QuadPts quadraticModEpsilonLines[] = {
|
2013-04-08 11:50:00 +00:00
|
|
|
{{{0, F}, {0, 0}, {1, 0}}},
|
|
|
|
{{{0, 0}, {1, 0}, {0, F}}},
|
|
|
|
{{{1, 0}, {0, F}, {0, 0}}},
|
|
|
|
{{{1, H}, {2, 0}, {3, 0}}},
|
2013-10-02 14:49:34 +00:00
|
|
|
// {{{F, 0}, {0, 0}, {0, 1}}}, // INVESTIGATE: even substituting K for F, quad is still linear.
|
|
|
|
// {{{0, 0}, {0, 1}, {F, 0}}},
|
|
|
|
// {{{0, 1}, {F, 0}, {0, 0}}},
|
|
|
|
// {{{H, 1}, {0, 2}, {0, 3}}},
|
2013-04-08 11:50:00 +00:00
|
|
|
{{{0, F}, {0, 0}, {1, 1}}},
|
|
|
|
{{{0, 0}, {1, 1}, {F, 0}}},
|
|
|
|
{{{1, 1}, {F, 0}, {0, 0}}},
|
|
|
|
{{{1, 1+J}, {2, 2}, {3, 3}}},
|
|
|
|
{{{1, 1}, {3, 3}, {3+F, 3}}},
|
|
|
|
{{{1, 1}, {1+F, 1}, {2, 2}}},
|
2015-03-26 14:52:43 +00:00
|
|
|
{{{1, 1}, {2, 2}, {1, 1+K}}},
|
2013-04-08 11:50:00 +00:00
|
|
|
{{{1, 1}, {1, 1+F}, {3, 3}}},
|
|
|
|
{{{1+H, 1}, {2, 2}, {4, 4}}}, // no coincident
|
|
|
|
{{{1, 1+K}, {3, 3}, {4, 4}}},
|
|
|
|
{{{1, 1}, {3+F, 3}, {2, 2}}},
|
|
|
|
{{{1, 1}, {4, 4+F}, {2, 2}}},
|
|
|
|
{{{1, 1}, {4, 4}, {3+F, 3}}},
|
|
|
|
{{{2, 2}, {1, 1}, {3, 3+F}}},
|
|
|
|
{{{2+F, 2}, {1, 1}, {4, 4}}},
|
|
|
|
{{{2, 2+F}, {3, 3}, {1, 1}}},
|
|
|
|
{{{2, 2}, {3+F, 3}, {4, 4}}},
|
|
|
|
{{{2, 2}, {4, 4+F}, {1, 1}}},
|
|
|
|
{{{2, 2}, {4, 4}, {3+F, 3}}},
|
|
|
|
};
|
|
|
|
|
|
|
|
const size_t quadraticModEpsilonLines_count =
|
2013-04-15 19:13:59 +00:00
|
|
|
SK_ARRAY_COUNT(quadraticModEpsilonLines);
|
2013-04-08 11:50:00 +00:00
|
|
|
|
2016-10-20 15:32:18 +00:00
|
|
|
const QuadPts quadraticTests[][2] = {
|
2013-04-08 11:50:00 +00:00
|
|
|
{ // one intersection
|
|
|
|
{{{0, 0},
|
|
|
|
{0, 1},
|
|
|
|
{1, 1}}},
|
|
|
|
{{{0, 1},
|
|
|
|
{0, 0},
|
|
|
|
{1, 0}}}
|
|
|
|
},
|
|
|
|
{ // four intersections
|
|
|
|
{{{1, 0},
|
|
|
|
{2, 6},
|
|
|
|
{3, 0}}},
|
|
|
|
{{{0, 1},
|
|
|
|
{6, 2},
|
|
|
|
{0, 3}}}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-04-15 19:13:59 +00:00
|
|
|
const size_t quadraticTests_count = SK_ARRAY_COUNT(quadraticTests);
|