public void suppressedTestLoopRelations2() { // Construct polygons consisting of a sequence of adjacent cell ids // at some fixed level. Comparing two polygons at the same level // ensures that there are no T-vertices. for (var iter = 0; iter < 1000; ++iter) { var num = (ulong)LongRandom(); var begin = new S2CellId(num | 1); if (!begin.IsValid) { continue; } begin = begin.ParentForLevel((int)Math.Round(rand.NextDouble() * S2CellId.MaxLevel)); var aBegin = advance(begin, skewed(6)); var aEnd = advance(aBegin, skewed(6) + 1); var bBegin = advance(begin, skewed(6)); var bEnd = advance(bBegin, skewed(6) + 1); if (!aEnd.IsValid || !bEnd.IsValid) { continue; } var a = makeCellLoop(aBegin, aEnd); var b = makeCellLoop(bBegin, bEnd); var contained = (aBegin <= bBegin && bEnd <= aEnd); var intersects = (aBegin < bEnd && bBegin < aEnd); Console.WriteLine( "Checking " + a.NumVertices + " vs. " + b.NumVertices + ", contained = " + contained + ", intersects = " + intersects); assertEquals(contained, a.Contains(b)); assertEquals(intersects, a.Intersects(b)); } }
public void suppressedTestLoopRelations2() { // Construct polygons consisting of a sequence of adjacent cell ids // at some fixed level. Comparing two polygons at the same level // ensures that there are no T-vertices. for (var iter = 0; iter < 1000; ++iter) { var num = (ulong)LongRandom(); var begin = new S2CellId(num | 1); if (!begin.IsValid) { continue; } begin = begin.ParentForLevel((int)Math.Round(rand.NextDouble()*S2CellId.MaxLevel)); var aBegin = advance(begin, skewed(6)); var aEnd = advance(aBegin, skewed(6) + 1); var bBegin = advance(begin, skewed(6)); var bEnd = advance(bBegin, skewed(6) + 1); if (!aEnd.IsValid || !bEnd.IsValid) { continue; } var a = makeCellLoop(aBegin, aEnd); var b = makeCellLoop(bBegin, bEnd); var contained = (aBegin <= bBegin && bEnd <= aEnd); var intersects = (aBegin < bEnd && bBegin < aEnd); Console.WriteLine( "Checking " + a.NumVertices + " vs. " + b.NumVertices + ", contained = " + contained + ", intersects = " + intersects); assertEquals(contained, a.Contains(b)); assertEquals(intersects, a.Intersects(b)); } }