generateCapEdges creates edges whose center is randomly chosen from the given cap, and whose length is randomly chosen up to maxLength.
(centerCap Cap, maxLength s1.Angle, count int)
| 70 | // generateCapEdges creates edges whose center is randomly chosen from the given cap, and |
| 71 | // whose length is randomly chosen up to maxLength. |
| 72 | func generateCapEdges(centerCap Cap, maxLength s1.Angle, count int) []Edge { |
| 73 | var edges []Edge |
| 74 | for range count { |
| 75 | center := samplePointFromCap(centerCap) |
| 76 | edgeCap := CapFromCenterAngle(center, 0.5*maxLength) |
| 77 | p1 := samplePointFromCap(edgeCap) |
| 78 | // Compute p1 reflected through center, and normalize for good measure. |
| 79 | p2 := Point{(center.Mul(2 * p1.Dot(center.Vector)).Sub(p1.Vector)).Normalize()} |
| 80 | edges = append(edges, Edge{p1, p2}) |
| 81 | } |
| 82 | return edges |
| 83 | } |
| 84 | |
| 85 | func testCrossingEdgeQueryAllCrossings(t *testing.T, edges []Edge) { |
| 86 | s := &edgeVectorShape{} |
no test coverage detected
searching dependent graphs…