Home | History | Annotate | Download | only in Intersection
      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 
      8 #include "QuadraticIntersection_TestData.h"
      9 
     10 const Quadratic quadraticLines[] = {
     11     {{0, 0}, {0, 0}, {1, 0}},
     12     {{0, 0}, {1, 0}, {0, 0}},
     13     {{1, 0}, {0, 0}, {0, 0}},
     14     {{1, 0}, {2, 0}, {3, 0}},
     15     {{0, 0}, {0, 0}, {0, 1}},
     16     {{0, 0}, {0, 1}, {0, 0}},
     17     {{0, 1}, {0, 0}, {0, 0}},
     18     {{0, 1}, {0, 2}, {0, 3}},
     19     {{0, 0}, {0, 0}, {1, 1}},
     20     {{0, 0}, {1, 1}, {0, 0}},
     21     {{1, 1}, {0, 0}, {0, 0}},
     22     {{1, 1}, {2, 2}, {3, 3}},
     23     {{1, 1}, {3, 3}, {3, 3}},
     24     {{1, 1}, {1, 1}, {2, 2}},
     25     {{1, 1}, {2, 2}, {1, 1}},
     26     {{1, 1}, {1, 1}, {3, 3}},
     27     {{1, 1}, {2, 2}, {4, 4}}, // no coincident
     28     {{1, 1}, {3, 3}, {4, 4}},
     29     {{1, 1}, {3, 3}, {2, 2}},
     30     {{1, 1}, {4, 4}, {2, 2}},
     31     {{1, 1}, {4, 4}, {3, 3}},
     32     {{2, 2}, {1, 1}, {3, 3}},
     33     {{2, 2}, {1, 1}, {4, 4}},
     34     {{2, 2}, {3, 3}, {1, 1}},
     35     {{2, 2}, {3, 3}, {4, 4}},
     36     {{2, 2}, {4, 4}, {1, 1}},
     37     {{2, 2}, {4, 4}, {3, 3}},
     38 };
     39 
     40 const size_t quadraticLines_count = sizeof(quadraticLines) / sizeof(quadraticLines[0]);
     41 
     42 static const double F = PointEpsilon * 3;
     43 static const double H = PointEpsilon * 4;
     44 static const double J = PointEpsilon * 5;
     45 static const double K = PointEpsilon * 8; // INVESTIGATE: why are larger multiples necessary?
     46 
     47 const Quadratic quadraticModEpsilonLines[] = {
     48     {{0, F}, {0, 0}, {1, 0}},
     49     {{0, 0}, {1, 0}, {0, F}},
     50     {{1, 0}, {0, F}, {0, 0}},
     51     {{1, H}, {2, 0}, {3, 0}},
     52     {{F, 0}, {0, 0}, {0, 1}},
     53     {{0, 0}, {0, 1}, {F, 0}},
     54     {{0, 1}, {F, 0}, {0, 0}},
     55     {{H, 1}, {0, 2}, {0, 3}},
     56     {{0, F}, {0, 0}, {1, 1}},
     57     {{0, 0}, {1, 1}, {F, 0}},
     58     {{1, 1}, {F, 0}, {0, 0}},
     59     {{1, 1+J}, {2, 2}, {3, 3}},
     60     {{1, 1}, {3, 3}, {3+F, 3}},
     61     {{1, 1}, {1+F, 1}, {2, 2}},
     62     {{1, 1}, {2, 2}, {1, 1+F}},
     63     {{1, 1}, {1, 1+F}, {3, 3}},
     64     {{1+H, 1}, {2, 2}, {4, 4}}, // no coincident
     65     {{1, 1+K}, {3, 3}, {4, 4}},
     66     {{1, 1}, {3+F, 3}, {2, 2}},
     67     {{1, 1}, {4, 4+F}, {2, 2}},
     68     {{1, 1}, {4, 4}, {3+F, 3}},
     69     {{2, 2}, {1, 1}, {3, 3+F}},
     70     {{2+F, 2}, {1, 1}, {4, 4}},
     71     {{2, 2+F}, {3, 3}, {1, 1}},
     72     {{2, 2}, {3+F, 3}, {4, 4}},
     73     {{2, 2}, {4, 4+F}, {1, 1}},
     74     {{2, 2}, {4, 4}, {3+F, 3}},
     75 };
     76 
     77 const size_t quadraticModEpsilonLines_count = sizeof(quadraticModEpsilonLines) / sizeof(quadraticModEpsilonLines[0]);
     78 
     79 const Quadratic quadraticTests[][2] = {
     80     { // one intersection
     81      {{0, 0},
     82       {0, 1},
     83       {1, 1}},
     84      {{0, 1},
     85       {0, 0},
     86       {1, 0}}
     87     },
     88     { // four intersections
     89      {{1, 0},
     90       {2, 6},
     91       {3, 0}},
     92      {{0, 1},
     93       {6, 2},
     94       {0, 3}}
     95     }
     96 };
     97 
     98 const size_t quadraticTests_count = sizeof(quadraticTests) / sizeof(quadraticTests[0]);
     99