Beispiel #1
0
    public void Test_S1ChordAngle_Successor()
    {
        Assert.Equal(S1ChordAngle.Zero, S1ChordAngle.Negative.Successor());
        Assert.Equal(S1ChordAngle.Infinity, S1ChordAngle.Straight.Successor());
        Assert.Equal(S1ChordAngle.Infinity, S1ChordAngle.Infinity.Successor());
        S1ChordAngle x = S1ChordAngle.Negative;

        for (int i = 0; i < 10; ++i)
        {
            Assert.True(x < x.Successor());
            x = x.Successor();
        }
    }
Beispiel #2
0
 // Equivalent to the constructor above.
 public void Init(S2ShapeIndex index, S1ChordAngle radius)
 {
     Radius            = radius;
     radius_successor_ = radius.Successor();
     query_.Init(index);
     query_.Options_.IncludeInteriors = (true);
 }
Beispiel #3
0
 // Constructs a region representing all points within the given radius of
 // any point in the given S2ShapeIndex.
 public S2ShapeIndexBufferedRegion(S2ShapeIndex index, S1ChordAngle radius)
 {
     Radius            = radius;
     radius_successor_ = radius.Successor();
     query_            = new S2ClosestEdgeQuery(index);
     query_.Options_.IncludeInteriors = (true);
 }
Beispiel #4
0
    public void Test_S2_UpdateMinInteriorDistanceLowerBoundOptimizationIsConservative()
    {
        // Verifies that AlwaysUpdateMinInteriorDistance() computes the lower bound
        // on the true distance conservatively.  (This test used to fail.)
        S2Point      x            = new(-0.017952729194524016, -0.30232422079175203, 0.95303607751077712);
        S2Point      a            = new(-0.017894725505830295, -0.30229974986194175, 0.95304493075220664);
        S2Point      b            = new(-0.017986591360900289, -0.30233851195954353, 0.95303090543659963);
        S1ChordAngle min_distance = S1ChordAngle.Infinity;

        Assert.True(S2.UpdateMinDistance(x, a, b, ref min_distance));
        min_distance = min_distance.Successor();
        Assert.True(S2.UpdateMinDistance(x, a, b, ref min_distance));
    }