aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/PathOpsQuadIntersectionTestData.cpp
blob: 0b0856117ba69d8e86e452c783444fc2fb754a93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
 * Copyright 2012 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "PathOpsQuadIntersectionTestData.h"

const SkDQuad quadraticPoints[] = {
    {{{0, 0}, {1, 0}, {0, 0}}},
    {{{0, 0}, {0, 1}, {0, 0}}},
    {{{0, 0}, {1, 1}, {0, 0}}},
    {{{1, 1}, {2, 2}, {1, 1}}},
};

const size_t quadraticPoints_count = SK_ARRAY_COUNT(quadraticPoints);

const SkDQuad quadraticLines[] = {
    {{{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}}},
};

const size_t quadraticLines_count = SK_ARRAY_COUNT(quadraticLines);

static const double F = FLT_EPSILON * 3;
static const double H = FLT_EPSILON * 4;
static const double J = FLT_EPSILON * 5;
static const double K = FLT_EPSILON * 8;  // INVESTIGATE: why are larger multiples necessary?

const SkDQuad quadraticModEpsilonLines[] = {
    {{{0, F}, {0, 0}, {1, 0}}},
    {{{0, 0}, {1, 0}, {0, F}}},
    {{{1, 0}, {0, F}, {0, 0}}},
    {{{1, H}, {2, 0}, {3, 0}}},
    {{{F, 0}, {0, 0}, {0, 1}}},
    {{{0, 0}, {0, 1}, {F, 0}}},
    {{{0, 1}, {F, 0}, {0, 0}}},
    {{{H, 1}, {0, 2}, {0, 3}}},
    {{{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}}},
    {{{1, 1}, {2, 2}, {1, 1+F}}},
    {{{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 =
        SK_ARRAY_COUNT(quadraticModEpsilonLines);

const SkDQuad quadraticTests[][2] = {
    {  // 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}}}
    }
};

const size_t quadraticTests_count = SK_ARRAY_COUNT(quadraticTests);