(t *testing.T)
| 336 | } |
| 337 | |
| 338 | func TestIntersectionLineEllipse(t *testing.T) { |
| 339 | var tts = []struct { |
| 340 | line, arc string |
| 341 | zs Intersections |
| 342 | }{ |
| 343 | // secant |
| 344 | {"M0 5L10 5", "A5 5 0 0 1 0 10", Intersections{ |
| 345 | {Point{5.0, 5.0}, [2]float64{0.5, 0.5}, [2]float64{0.0, 0.5 * math.Pi}, false, false}, |
| 346 | }}, |
| 347 | {"M0 5L10 5", "A5 5 0 1 1 0 10", Intersections{ |
| 348 | {Point{5.0, 5.0}, [2]float64{0.5, 0.5}, [2]float64{0.0, 0.5 * math.Pi}, false, false}, |
| 349 | }}, |
| 350 | {"M0 5L-10 5", "A5 5 0 0 0 0 10", Intersections{ |
| 351 | {Point{-5.0, 5.0}, [2]float64{0.5, 0.5}, [2]float64{math.Pi, 0.5 * math.Pi}, false, false}, |
| 352 | }}, |
| 353 | {"M-5 0L-5 -10", "A5 5 0 0 0 -10 0", Intersections{ |
| 354 | {Point{-5.0, -5.0}, [2]float64{0.5, 0.5}, [2]float64{1.5 * math.Pi, math.Pi}, false, false}, |
| 355 | }}, |
| 356 | {"M0 10L10 10", "A10 5 90 0 1 0 20", Intersections{ |
| 357 | {Point{5.0, 10.0}, [2]float64{0.5, 0.5}, [2]float64{0.0, 0.5 * math.Pi}, false, false}, |
| 358 | }}, |
| 359 | |
| 360 | // tangent |
| 361 | {"M-5 0L-15 0", "A5 5 0 0 0 -10 0", Intersections{ |
| 362 | {Point{-10.0, 0.0}, [2]float64{0.5, 1.0}, [2]float64{math.Pi, 0.5 * math.Pi}, true, false}, |
| 363 | }}, |
| 364 | {"M-5 0L-15 0", "A5 5 0 0 1 -10 0", Intersections{ |
| 365 | {Point{-10.0, 0.0}, [2]float64{0.5, 1.0}, [2]float64{math.Pi, 1.5 * math.Pi}, true, false}, |
| 366 | }}, |
| 367 | {"L0 10", "A10 5 0 0 1 0 10", Intersections{ |
| 368 | {Point{0.0, 0.0}, [2]float64{0.0, 0.0}, [2]float64{0.5 * math.Pi, 0.0}, true, false}, |
| 369 | {Point{0.0, 10.0}, [2]float64{1.0, 1.0}, [2]float64{0.5 * math.Pi, math.Pi}, true, false}, |
| 370 | }}, |
| 371 | {"M5 0L5 10", "A5 5 0 0 1 0 10", Intersections{ |
| 372 | {Point{5.0, 5.0}, [2]float64{0.5, 0.5}, [2]float64{0.5 * math.Pi, 0.5 * math.Pi}, true, false}, |
| 373 | }}, |
| 374 | {"M-5 0L-5 10", "A5 5 0 0 0 0 10", Intersections{ |
| 375 | {Point{-5.0, 5.0}, [2]float64{0.5, 0.5}, [2]float64{0.5 * math.Pi, 0.5 * math.Pi}, true, false}, |
| 376 | }}, |
| 377 | {"M5 0L5 20", "A10 5 90 0 1 0 20", Intersections{ |
| 378 | {Point{5.0, 10.0}, [2]float64{0.5, 0.5}, [2]float64{0.5 * math.Pi, 0.5 * math.Pi}, true, false}, |
| 379 | }}, |
| 380 | {"M4 3L0 3", "M2 3A1 1 0 0 0 4 3", Intersections{ |
| 381 | {Point{4.0, 3.0}, [2]float64{0.0, 1.0}, [2]float64{math.Pi, 1.5 * math.Pi}, true, false}, |
| 382 | {Point{2.0, 3.0}, [2]float64{0.5, 0.0}, [2]float64{math.Pi, 0.5 * math.Pi}, true, false}, |
| 383 | }}, |
| 384 | |
| 385 | // none |
| 386 | {"M6 0L6 10", "A5 5 0 0 1 0 10", Intersections{}}, |
| 387 | {"M10 5L15 5", "A5 5 0 0 1 0 10", Intersections{}}, |
| 388 | {"M6 0L6 20", "A10 5 90 0 1 0 20", Intersections{}}, |
| 389 | |
| 390 | // bugs |
| 391 | {"M0 -0.7L1 -0.7", "M-0.7 0A0.7 0.7 0 0 1 0.7 0", Intersections{ |
| 392 | {Point{0.0, -0.7}, [2]float64{0.0, 0.5}, [2]float64{0.0, 0.0}, true, false}, |
| 393 | }}, // #200, at intersection the arc angle is deviated towards positive angle |
| 394 | {"M30.23402723090112,37.620459766287226L30.170131507649785,37.66143576791836", "M30.242341004748596 37.609669236818846A0.8700000000000001 0.8700000000000001 0 0 1 28.82999999999447 36.9294", Intersections{ |
| 395 | {Point{30.170131507649785, 37.66143576791836}, [2]float64{1.0, 0.04553266140095003}, [2]float64{2.571361371137828, 2.570702752627385}, true, false}, |
nothing calls this directly
no test coverage detected