MCPcopy Create free account
hub / github.com/tdewolff/canvas / TestIntersectionRayCircle

Function TestIntersectionRayCircle

path_intersection_test.go:12–32  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestIntersectionRayCircle(t *testing.T) {
13 var tts = []struct {
14 l0, l1 Point
15 c Point
16 r float64
17 p0, p1 Point
18 }{
19 {Point{0.0, 0.0}, Point{0.0, 1.0}, Point{0.0, 0.0}, 2.0, Point{0.0, 2.0}, Point{0.0, -2.0}},
20 {Point{2.0, 0.0}, Point{2.0, 1.0}, Point{0.0, 0.0}, 2.0, Point{2.0, 0.0}, Point{2.0, 0.0}},
21 {Point{0.0, 2.0}, Point{1.0, 2.0}, Point{0.0, 0.0}, 2.0, Point{0.0, 2.0}, Point{0.0, 2.0}},
22 {Point{0.0, 3.0}, Point{1.0, 3.0}, Point{0.0, 0.0}, 2.0, Point{}, Point{}},
23 {Point{0.0, 1.0}, Point{0.0, 0.0}, Point{0.0, 0.0}, 2.0, Point{0.0, 2.0}, Point{0.0, -2.0}},
24 }
25 for i, tt := range tts {
26 t.Run(fmt.Sprint(i), func(t *testing.T) {
27 p0, p1, _ := intersectionRayCircle(tt.l0, tt.l1, tt.c, tt.r)
28 test.T(t, p0, tt.p0)
29 test.T(t, p1, tt.p1)
30 })
31 }
32}
33
34func TestIntersectionCircleCircle(t *testing.T) {
35 var tts = []struct {

Callers

nothing calls this directly

Calls 3

intersectionRayCircleFunction · 0.85
TMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected