PathOpsQuadIntersectionTestData.cpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Copyright 2012 Google Inc.
  3. *
  4. * Use of this source code is governed by a BSD-style license that can be
  5. * found in the LICENSE file.
  6. */
  7. #include "tests/PathOpsQuadIntersectionTestData.h"
  8. const QuadPts quadraticPoints[] = {
  9. {{{0, 0}, {1, 0}, {0, 0}}},
  10. {{{0, 0}, {0, 1}, {0, 0}}},
  11. {{{0, 0}, {1, 1}, {0, 0}}},
  12. {{{1, 1}, {2, 2}, {1, 1}}},
  13. };
  14. const size_t quadraticPoints_count = SK_ARRAY_COUNT(quadraticPoints);
  15. const QuadPts quadraticLines[] = {
  16. {{{0, 0}, {0, 0}, {1, 0}}},
  17. {{{1, 0}, {0, 0}, {0, 0}}},
  18. {{{1, 0}, {2, 0}, {3, 0}}},
  19. {{{0, 0}, {0, 0}, {0, 1}}},
  20. {{{0, 1}, {0, 0}, {0, 0}}},
  21. {{{0, 1}, {0, 2}, {0, 3}}},
  22. {{{0, 0}, {0, 0}, {1, 1}}},
  23. {{{1, 1}, {0, 0}, {0, 0}}},
  24. {{{1, 1}, {2, 2}, {3, 3}}},
  25. {{{1, 1}, {3, 3}, {3, 3}}},
  26. {{{1, 1}, {1, 1}, {2, 2}}},
  27. {{{1, 1}, {1, 1}, {3, 3}}},
  28. {{{1, 1}, {2, 2}, {4, 4}}}, // no coincident
  29. {{{1, 1}, {3, 3}, {4, 4}}},
  30. {{{1, 1}, {3, 3}, {2, 2}}},
  31. {{{1, 1}, {4, 4}, {2, 2}}},
  32. {{{1, 1}, {4, 4}, {3, 3}}},
  33. {{{2, 2}, {1, 1}, {3, 3}}},
  34. {{{2, 2}, {1, 1}, {4, 4}}},
  35. {{{2, 2}, {3, 3}, {1, 1}}},
  36. {{{2, 2}, {3, 3}, {4, 4}}},
  37. {{{2, 2}, {4, 4}, {1, 1}}},
  38. {{{2, 2}, {4, 4}, {3, 3}}},
  39. };
  40. const size_t quadraticLines_count = SK_ARRAY_COUNT(quadraticLines);
  41. static const double F = FLT_EPSILON * 32;
  42. static const double H = FLT_EPSILON * 32;
  43. static const double J = FLT_EPSILON * 32;
  44. static const double K = FLT_EPSILON * 32; // INVESTIGATE: why are larger multiples necessary?
  45. const QuadPts quadraticModEpsilonLines[] = {
  46. {{{0, F}, {0, 0}, {1, 0}}},
  47. {{{0, 0}, {1, 0}, {0, F}}},
  48. {{{1, 0}, {0, F}, {0, 0}}},
  49. {{{1, H}, {2, 0}, {3, 0}}},
  50. // {{{F, 0}, {0, 0}, {0, 1}}}, // INVESTIGATE: even substituting K for F, quad is still linear.
  51. // {{{0, 0}, {0, 1}, {F, 0}}},
  52. // {{{0, 1}, {F, 0}, {0, 0}}},
  53. // {{{H, 1}, {0, 2}, {0, 3}}},
  54. {{{0, F}, {0, 0}, {1, 1}}},
  55. {{{0, 0}, {1, 1}, {F, 0}}},
  56. {{{1, 1}, {F, 0}, {0, 0}}},
  57. {{{1, 1+J}, {2, 2}, {3, 3}}},
  58. {{{1, 1}, {3, 3}, {3+F, 3}}},
  59. {{{1, 1}, {1+F, 1}, {2, 2}}},
  60. {{{1, 1}, {2, 2}, {1, 1+K}}},
  61. {{{1, 1}, {1, 1+F}, {3, 3}}},
  62. {{{1+H, 1}, {2, 2}, {4, 4}}}, // no coincident
  63. {{{1, 1+K}, {3, 3}, {4, 4}}},
  64. {{{1, 1}, {3+F, 3}, {2, 2}}},
  65. {{{1, 1}, {4, 4+F}, {2, 2}}},
  66. {{{1, 1}, {4, 4}, {3+F, 3}}},
  67. {{{2, 2}, {1, 1}, {3, 3+F}}},
  68. {{{2+F, 2}, {1, 1}, {4, 4}}},
  69. {{{2, 2+F}, {3, 3}, {1, 1}}},
  70. {{{2, 2}, {3+F, 3}, {4, 4}}},
  71. {{{2, 2}, {4, 4+F}, {1, 1}}},
  72. {{{2, 2}, {4, 4}, {3+F, 3}}},
  73. };
  74. const size_t quadraticModEpsilonLines_count =
  75. SK_ARRAY_COUNT(quadraticModEpsilonLines);
  76. const QuadPts quadraticTests[][2] = {
  77. { // one intersection
  78. {{{0, 0},
  79. {0, 1},
  80. {1, 1}}},
  81. {{{0, 1},
  82. {0, 0},
  83. {1, 0}}}
  84. },
  85. { // four intersections
  86. {{{1, 0},
  87. {2, 6},
  88. {3, 0}}},
  89. {{{0, 1},
  90. {6, 2},
  91. {0, 3}}}
  92. }
  93. };
  94. const size_t quadraticTests_count = SK_ARRAY_COUNT(quadraticTests);