Ejemplo n.º 1
0
    public void Test_S2VertexIdLaxLoopShape_EmptyLoop()
    {
        var shape = new S2VertexIdLaxLoopShape(Array.Empty <int>(), null);

        Assert.Equal(0, shape.NumEdges());
        Assert.Equal(0, shape.NumVertices);
        Assert.Equal(0, shape.NumChains());
        Assert.Equal(2, shape.Dimension());
        Assert.True(shape.IsEmpty());
        Assert.False(shape.IsFull());
        Assert.False(shape.GetReferencePoint().Contained);
    }
Ejemplo n.º 2
0
    public void Test_S2VertexIdLaxLoopShape_InvertedLoop()
    {
        var vertex_array = ParsePointsOrDie("0:0, 0:1, 1:1, 1:0");
        var vertex_ids   = new[] { 0, 3, 2, 1 }; // Inverted.
        var shape        = new S2VertexIdLaxLoopShape(vertex_ids, vertex_array.ToArray());

        Assert.Equal(4, shape.NumEdges());
        Assert.Equal(4, shape.NumVertices);
        Assert.Equal(1, shape.NumChains());
        Assert.Equal(0, shape.GetChain(0).Start);
        Assert.Equal(4, shape.GetChain(0).Length);
        Assert.Equal(vertex_array[0], shape.Vertex(0));
        Assert.Equal(vertex_array[3], shape.Vertex(1));
        Assert.Equal(vertex_array[2], shape.Vertex(2));
        Assert.Equal(vertex_array[1], shape.Vertex(3));
        Assert.Equal(2, shape.Dimension());
        Assert.False(shape.IsEmpty());
        Assert.False(shape.IsFull());
        Assert.True(shape.ContainsBruteForce(S2.Origin));
    }