MCPcopy
hub / github.com/golang/geo / TestCapContainsPoint

Function TestCapContainsPoint

s2/cap_test.go:159–186  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

157}
158
159func TestCapContainsPoint(t *testing.T) {
160 tangent := tiny.center.Cross(r3.Vector{X: 3, Y: 2, Z: 1}).Normalize()
161 tests := []struct {
162 c Cap
163 p Point
164 want bool
165 }{
166 {xAxis, xAxisPt, true},
167 {xAxis, Point{r3.Vector{X: 1, Y: 1e-20, Z: 0}}, false},
168 {yAxis, xAxis.center, false},
169 {xComp, xAxis.center, true},
170 {xComp.Complement(), xAxis.center, false},
171 {tiny, Point{tiny.center.Add(tangent.Mul(tinyRad * 0.99))}, true},
172 {tiny, Point{tiny.center.Add(tangent.Mul(tinyRad * 1.01))}, false},
173 {hemi, PointFromCoords(1, 0, -(1 - epsilon)), true},
174 {hemi, xAxisPt, true},
175 {hemi.Complement(), xAxisPt, false},
176 {concaveMax, PointFromLatLng(LatLngFromDegrees(-70*(1-epsilon), 10)), true},
177 {concaveMin, PointFromLatLng(LatLngFromDegrees(-70*(1+epsilon), 10)), false},
178 {concaveMax, PointFromLatLng(LatLngFromDegrees(-50*(1-epsilon), -170)), true},
179 {concaveMin, PointFromLatLng(LatLngFromDegrees(-50*(1+epsilon), -170)), false},
180 }
181 for _, test := range tests {
182 if got := test.c.ContainsPoint(test.p); got != test.want {
183 t.Errorf("%v.ContainsPoint(%v) = %t, want %t", test.c, test.p, got, test.want)
184 }
185 }
186}
187
188func TestCapInteriorIntersects(t *testing.T) {
189 tests := []struct {

Callers

nothing calls this directly

Calls 9

PointFromCoordsFunction · 0.85
PointFromLatLngFunction · 0.85
LatLngFromDegreesFunction · 0.85
ContainsPointMethod · 0.65
NormalizeMethod · 0.45
CrossMethod · 0.45
ComplementMethod · 0.45
AddMethod · 0.45
MulMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…