Beispiel #1
0
    public void Test_S2ShapeIndexRegion_GetCapBound()
    {
        var id = S2CellId.FromDebugString("3/0123012301230123012301230123");

        // Add a polygon that is slightly smaller than the cell being tested.
        MutableS2ShapeIndex index = new();

        index.Add(NewPaddedCell(id, -kPadding));
        S2Cap cell_bound  = new S2Cell(id).GetCapBound();
        S2Cap index_bound = index.MakeS2ShapeIndexRegion().GetCapBound();

        Assert.True(index_bound.Contains(cell_bound));

        // Note that S2CellUnion.GetCapBound returns a slightly larger bound than
        // S2Cell.GetBound even when the cell union consists of a single S2CellId.
        Assert.True(index_bound.RadiusAngle() <= 1.00001 * cell_bound.RadiusAngle());
    }