(t *testing.T)
| 379 | } |
| 380 | |
| 381 | func TestRectCapBound(t *testing.T) { |
| 382 | tests := []struct { |
| 383 | r Rect |
| 384 | want Cap |
| 385 | }{ |
| 386 | { // Bounding cap at center is smaller. |
| 387 | rectFromDegrees(-45, -45, 45, 45), |
| 388 | CapFromCenterHeight(Point{r3.Vector{X: 1, Y: 0, Z: 0}}, 0.5), |
| 389 | }, |
| 390 | { // Bounding cap at north pole is smaller. |
| 391 | rectFromDegrees(88, -80, 89, 80), |
| 392 | CapFromCenterAngle(Point{r3.Vector{X: 0, Y: 0, Z: 1}}, s1.Angle(2)*s1.Degree), |
| 393 | }, |
| 394 | { // Longitude span > 180 degrees. |
| 395 | rectFromDegrees(-30, -150, -10, 50), |
| 396 | CapFromCenterAngle(Point{r3.Vector{X: 0, Y: 0, Z: -1}}, s1.Angle(80)*s1.Degree), |
| 397 | }, |
| 398 | { |
| 399 | // Longitude span > 180 degrees and latitude span > 90 degrees. This results |
| 400 | // in a polar cap that is larger than the "midpoint cap" (centered at the |
| 401 | // center of the rect and containing the vertices), but is nonetheless the |
| 402 | // correct result. The "midpoint cap" must not be returned since it doesn't |
| 403 | // contain the entire rect due the rect being wider than 180 degrees. |
| 404 | // In this example, (-34, 49) is in the rect but not the midpoint cap. |
| 405 | rectFromDegrees(-60, -150, 70, 50), |
| 406 | CapFromCenterAngle(Point{r3.Vector{X: 0, Y: 0, Z: 1}}, s1.Angle(150)*s1.Degree), |
| 407 | }, |
| 408 | } |
| 409 | for _, test := range tests { |
| 410 | if got := test.r.CapBound(); !test.want.ApproxEqual(got) { |
| 411 | t.Errorf("%v.CapBound() was %v, want %v", test.r, got, test.want) |
| 412 | } |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | func TestRectIntervalOps(t *testing.T) { |
| 417 | // Rectangle that covers one-quarter of the sphere. |
nothing calls this directly
no test coverage detected
searching dependent graphs…