private void dumpCrossings(S2Loop loop) { Console.WriteLine("Ortho(v1): " + S2.Ortho(loop.Vertex(1))); Console.WriteLine("Contains(kOrigin): {0}\n", loop.Contains(S2.Origin)); for (var i = 1; i <= loop.NumVertices; ++i) { var a = S2.Ortho(loop.Vertex(i)); var b = loop.Vertex(i - 1); var c = loop.Vertex(i + 1); var o = loop.Vertex(i); Console.WriteLine("Vertex {0}: [%.17g, %.17g, %.17g], " + "%d%dR=%d, %d%d%d=%d, R%d%d=%d, inside: %b\n", i, loop.Vertex(i).X, loop.Vertex(i).Y, loop.Vertex(i).Z, i - 1, i, S2.RobustCcw(b, o, a), i + 1, i, i - 1, S2.RobustCcw(c, o, b), i, i + 1, S2.RobustCcw(a, o, c), S2.OrderedCcw(a, b, c, o)); } for (var i = 0; i < loop.NumVertices + 2; ++i) { var orig = S2.Origin; S2Point dest; if (i < loop.NumVertices) { dest = loop.Vertex(i); Console.WriteLine("Origin->{0} crosses:", i); } else { dest = new S2Point(0, 0, 1); if (i == loop.NumVertices + 1) { orig = loop.Vertex(1); } Console.WriteLine("Case {0}:", i); } for (var j = 0; j < loop.NumVertices; ++j) { Console.WriteLine( " " + S2EdgeUtil.EdgeOrVertexCrossing(orig, dest, loop.Vertex(j), loop.Vertex(j + 1))); } Console.WriteLine(); } for (var i = 0; i <= 2; i += 2) { Console.WriteLine("Origin->v1 crossing v{0}->v1: ", i); var a = S2.Ortho(loop.Vertex(1)); var b = loop.Vertex(i); var c = S2.Origin; var o = loop.Vertex(1); Console.WriteLine("{0}1R={1}, M1{2}={3}, R1M={4}, crosses: {5}\n", i, S2.RobustCcw(b, o, a), i, S2.RobustCcw(c, o, b), S2.RobustCcw(a, o, c), S2EdgeUtil.EdgeOrVertexCrossing(c, o, b, a)); } }