(t *testing.T)
| 55 | } |
| 56 | |
| 57 | func TestIntersectionLineLine(t *testing.T) { |
| 58 | var tts = []struct { |
| 59 | line1, line2 string |
| 60 | zs Intersections |
| 61 | }{ |
| 62 | // secant |
| 63 | {"M2 0L2 3", "M1 2L3 2", Intersections{ |
| 64 | {Point{2.0, 2.0}, [2]float64{2.0 / 3.0, 0.5}, [2]float64{0.5 * math.Pi, 0.0}, false, false}, |
| 65 | }}, |
| 66 | |
| 67 | // tangent |
| 68 | {"M2 0L2 3", "M2 2L3 2", Intersections{ |
| 69 | {Point{2.0, 2.0}, [2]float64{2.0 / 3.0, 0.0}, [2]float64{0.5 * math.Pi, 0.0}, true, false}, |
| 70 | }}, |
| 71 | {"M2 0L2 2", "M2 2L3 2", Intersections{ |
| 72 | {Point{2.0, 2.0}, [2]float64{1.0, 0.0}, [2]float64{0.5 * math.Pi, 0.0}, true, false}, |
| 73 | }}, |
| 74 | {"L2 2", "M0 4L2 2", Intersections{ |
| 75 | {Point{2.0, 2.0}, [2]float64{1.0, 1.0}, [2]float64{0.25 * math.Pi, 1.75 * math.Pi}, true, false}, |
| 76 | }}, |
| 77 | {"L10 5", "M0 10L10 5", Intersections{ |
| 78 | {Point{10.0, 5.0}, [2]float64{1.0, 1.0}, [2]float64{Point{2.0, 1.0}.Angle(), Point{2.0, -1.0}.Angle()}, true, false}, |
| 79 | }}, |
| 80 | {"M10 5L20 10", "M10 5L20 0", Intersections{ |
| 81 | {Point{10.0, 5.0}, [2]float64{0.0, 0.0}, [2]float64{Point{2.0, 1.0}.Angle(), Point{2.0, -1.0}.Angle()}, true, false}, |
| 82 | }}, |
| 83 | |
| 84 | // parallel |
| 85 | {"L2 2", "L2 2", Intersections{ |
| 86 | {Point{0.0, 0.0}, [2]float64{0.0, 0.0}, [2]float64{0.25 * math.Pi, 0.25 * math.Pi}, true, true}, |
| 87 | {Point{2.0, 2.0}, [2]float64{1.0, 1.0}, [2]float64{0.25 * math.Pi, 0.25 * math.Pi}, true, true}, |
| 88 | }}, |
| 89 | {"L2 2", "M2 2L0 0", Intersections{ |
| 90 | {Point{0.0, 0.0}, [2]float64{0.0, 1.0}, [2]float64{0.25 * math.Pi, 1.25 * math.Pi}, true, true}, |
| 91 | {Point{2.0, 2.0}, [2]float64{1.0, 0.0}, [2]float64{0.25 * math.Pi, 1.25 * math.Pi}, true, true}, |
| 92 | }}, |
| 93 | {"L2 2", "M3 3L5 5", Intersections{}}, |
| 94 | {"L2 2", "M-1 1L1 3", Intersections{}}, |
| 95 | {"L2 2", "M2 2L4 4", Intersections{ |
| 96 | {Point{2.0, 2.0}, [2]float64{1.0, 0.0}, [2]float64{0.25 * math.Pi, 0.25 * math.Pi}, true, false}, |
| 97 | }}, |
| 98 | {"L2 2", "M-2 -2L0 0", Intersections{ |
| 99 | {Point{0.0, 0.0}, [2]float64{0.0, 1.0}, [2]float64{0.25 * math.Pi, 0.25 * math.Pi}, true, false}, |
| 100 | }}, |
| 101 | {"L4 4", "M2 2L6 6", Intersections{ |
| 102 | {Point{2.0, 2.0}, [2]float64{0.5, 0.0}, [2]float64{0.25 * math.Pi, 0.25 * math.Pi}, true, true}, |
| 103 | {Point{4.0, 4.0}, [2]float64{1.0, 0.5}, [2]float64{0.25 * math.Pi, 0.25 * math.Pi}, true, true}, |
| 104 | }}, |
| 105 | {"L4 4", "M-2 -2L2 2", Intersections{ |
| 106 | {Point{0.0, 0.0}, [2]float64{0.0, 0.5}, [2]float64{0.25 * math.Pi, 0.25 * math.Pi}, true, true}, |
| 107 | {Point{2.0, 2.0}, [2]float64{0.5, 1.0}, [2]float64{0.25 * math.Pi, 0.25 * math.Pi}, true, true}, |
| 108 | }}, |
| 109 | |
| 110 | // none |
| 111 | {"M2 0L2 1", "M3 0L3 1", Intersections{}}, |
| 112 | {"M2 0L2 1", "M0 2L1 2", Intersections{}}, |
| 113 | |
| 114 | // bugs |
nothing calls this directly
no test coverage detected