|
35 | 35 | fullHeight = 2.0
|
36 | 36 | emptyHeight = -1.0
|
37 | 37 |
|
38 |
| - xAxisPt = Point{r3.Vector{1, 0, 0}} |
39 |
| - yAxisPt = Point{r3.Vector{0, 1, 0}} |
| 38 | + xAxisPt = Point{r3.Vector{X: 1, Y: 0, Z: 0}} |
| 39 | + yAxisPt = Point{r3.Vector{X: 0, Y: 1, Z: 0}} |
40 | 40 |
|
41 | 41 | xAxis = CapFromPoint(xAxisPt)
|
42 | 42 | yAxis = CapFromPoint(yAxisPt)
|
@@ -157,14 +157,14 @@ func TestCapContains(t *testing.T) {
|
157 | 157 | }
|
158 | 158 |
|
159 | 159 | func TestCapContainsPoint(t *testing.T) {
|
160 |
| - tangent := tiny.center.Cross(r3.Vector{3, 2, 1}).Normalize() |
| 160 | + tangent := tiny.center.Cross(r3.Vector{X: 3, Y: 2, Z: 1}).Normalize() |
161 | 161 | tests := []struct {
|
162 | 162 | c Cap
|
163 | 163 | p Point
|
164 | 164 | want bool
|
165 | 165 | }{
|
166 | 166 | {xAxis, xAxisPt, true},
|
167 |
| - {xAxis, Point{r3.Vector{1, 1e-20, 0}}, false}, |
| 167 | + {xAxis, Point{r3.Vector{X: 1, Y: 1e-20, Z: 0}}, false}, |
168 | 168 | {yAxis, xAxis.center, false},
|
169 | 169 | {xComp, xAxis.center, true},
|
170 | 170 | {xComp.Complement(), xAxis.center, false},
|
@@ -208,9 +208,9 @@ func TestCapInteriorIntersects(t *testing.T) {
|
208 | 208 | }
|
209 | 209 |
|
210 | 210 | func TestCapInteriorContains(t *testing.T) {
|
211 |
| - if hemi.InteriorContainsPoint(Point{r3.Vector{1, 0, -(1 + epsilon)}}) { |
| 211 | + if hemi.InteriorContainsPoint(Point{r3.Vector{X: 1, Y: 0, Z: -(1 + epsilon)}}) { |
212 | 212 | t.Errorf("hemi (%v) should not contain point just past half way(%v)", hemi,
|
213 |
| - Point{r3.Vector{1, 0, -(1 + epsilon)}}) |
| 213 | + Point{r3.Vector{X: 1, Y: 0, Z: -(1 + epsilon)}}) |
214 | 214 | }
|
215 | 215 | }
|
216 | 216 |
|
@@ -316,7 +316,7 @@ func TestCapRectBounds(t *testing.T) {
|
316 | 316 | },
|
317 | 317 | {
|
318 | 318 | "The eastern hemisphere.",
|
319 |
| - CapFromCenterAngle(Point{r3.Vector{0, 1, 0}}, s1.Radian*(math.Pi/2+2e-16)), |
| 319 | + CapFromCenterAngle(Point{r3.Vector{X: 0, Y: 1, Z: 0}}, s1.Radian*(math.Pi/2+2e-16)), |
320 | 320 | -90, 90, -180, 180, true,
|
321 | 321 | },
|
322 | 322 | {
|
@@ -376,34 +376,34 @@ func TestCapAddPoint(t *testing.T) {
|
376 | 376 | {yAxis, yAxisPt, yAxis},
|
377 | 377 |
|
378 | 378 | // Cap plus opposite point equals full.
|
379 |
| - {xAxis, Point{r3.Vector{-1, 0, 0}}, fullCap}, |
380 |
| - {yAxis, Point{r3.Vector{0, -1, 0}}, fullCap}, |
| 379 | + {xAxis, Point{r3.Vector{X: -1, Y: 0, Z: 0}}, fullCap}, |
| 380 | + {yAxis, Point{r3.Vector{X: 0, Y: -1, Z: 0}}, fullCap}, |
381 | 381 |
|
382 | 382 | // Cap plus orthogonal axis equals half cap.
|
383 |
| - {xAxis, Point{r3.Vector{0, 0, 1}}, CapFromCenterAngle(xAxisPt, s1.Angle(math.Pi/2.0))}, |
384 |
| - {xAxis, Point{r3.Vector{0, 0, -1}}, CapFromCenterAngle(xAxisPt, s1.Angle(math.Pi/2.0))}, |
| 383 | + {xAxis, Point{r3.Vector{X: 0, Y: 0, Z: 1}}, CapFromCenterAngle(xAxisPt, s1.Angle(math.Pi/2.0))}, |
| 384 | + {xAxis, Point{r3.Vector{X: 0, Y: 0, Z: -1}}, CapFromCenterAngle(xAxisPt, s1.Angle(math.Pi/2.0))}, |
385 | 385 |
|
386 | 386 | // The 45 degree angled hemisphere plus some points.
|
387 | 387 | {
|
388 | 388 | hemi,
|
389 | 389 | PointFromCoords(0, 1, -1),
|
390 |
| - CapFromCenterAngle(Point{r3.Vector{1, 0, 1}}, |
| 390 | + CapFromCenterAngle(Point{r3.Vector{X: 1, Y: 0, Z: 1}}, |
391 | 391 | s1.Angle(120.0)*s1.Degree),
|
392 | 392 | },
|
393 | 393 | {
|
394 | 394 | hemi,
|
395 | 395 | PointFromCoords(0, -1, -1),
|
396 |
| - CapFromCenterAngle(Point{r3.Vector{1, 0, 1}}, |
| 396 | + CapFromCenterAngle(Point{r3.Vector{X: 1, Y: 0, Z: 1}}, |
397 | 397 | s1.Angle(120.0)*s1.Degree),
|
398 | 398 | },
|
399 | 399 | {
|
400 | 400 | hemi,
|
401 | 401 | PointFromCoords(-1, -1, -1),
|
402 |
| - CapFromCenterAngle(Point{r3.Vector{1, 0, 1}}, |
| 402 | + CapFromCenterAngle(Point{r3.Vector{X: 1, Y: 0, Z: 1}}, |
403 | 403 | s1.Angle(math.Acos(-math.Sqrt(2.0/3.0)))),
|
404 | 404 | },
|
405 |
| - {hemi, Point{r3.Vector{0, 1, 1}}, hemi}, |
406 |
| - {hemi, Point{r3.Vector{1, 0, 0}}, hemi}, |
| 405 | + {hemi, Point{r3.Vector{X: 0, Y: 1, Z: 1}}, hemi}, |
| 406 | + {hemi, Point{r3.Vector{X: 1, Y: 0, Z: 0}}, hemi}, |
407 | 407 | }
|
408 | 408 |
|
409 | 409 | for _, test := range tests {
|
@@ -684,8 +684,8 @@ func TestCapUnion(t *testing.T) {
|
684 | 684 | t.Errorf("%v.Radius = %v, want %v", aUnionE, got, want)
|
685 | 685 | }
|
686 | 686 |
|
687 |
| - p1 := Point{r3.Vector{0, 0, 1}} |
688 |
| - p2 := Point{r3.Vector{0, 1, 0}} |
| 687 | + p1 := Point{r3.Vector{X: 0, Y: 0, Z: 1}} |
| 688 | + p2 := Point{r3.Vector{X: 0, Y: 1, Z: 0}} |
689 | 689 | // Two very large caps, whose radius sums to in excess of 180 degrees, and
|
690 | 690 | // whose centers are not antipodal.
|
691 | 691 | f := CapFromCenterAngle(p1, s1.Degree*150)
|
|
0 commit comments