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

Function TestPolylineIntersectsCell

s2/polyline_test.go:141–153  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

139}
140
141func TestPolylineIntersectsCell(t *testing.T) {
142 pline := Polyline{
143 Point{r3.Vector{X: 1, Y: -1.1, Z: 0.8}.Normalize()},
144 Point{r3.Vector{X: 1, Y: -0.8, Z: 1.1}.Normalize()},
145 }
146
147 for face := range 6 {
148 cell := CellFromCellID(CellIDFromFace(face))
149 if got, want := pline.IntersectsCell(cell), face&1 == 0; got != want {
150 t.Errorf("%v.IntersectsCell(%v) = %v, want %v", pline, cell, got, want)
151 }
152 }
153}
154
155func TestPolylineSubsample(t *testing.T) {
156 const polyStr = "0:0, 0:1, -1:2, 0:3, 0:4, 1:4, 2:4.5, 3:4, 3.5:4, 4:4"

Callers

nothing calls this directly

Calls 4

IntersectsCellMethod · 0.95
CellFromCellIDFunction · 0.85
CellIDFromFaceFunction · 0.85
NormalizeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…