public void Test_S2LatLngRect_AddPoint() { S2LatLngRect p = S2LatLngRect.Empty; p = p.AddPoint(S2LatLng.FromDegrees(0, 0)); Assert.True(p.IsPoint()); p = p.AddPoint(S2LatLng.FromRadians(0, -S2.M_PI_2)); Assert.False(p.IsPoint()); p = p.AddPoint(S2LatLng.FromRadians(S2.M_PI_4, -Math.PI)); p = p.AddPoint(new S2Point(0, 0, 1)); Assert.Equal(p, RectFromDegrees(0, -180, 90, 0)); }
public void Test_S2LatLngRect_EmptyAndFull() { // Test basic properties of empty and full rectangles. S2LatLngRect empty = S2LatLngRect.Empty; S2LatLngRect full = S2LatLngRect.Full; Assert.True(empty.IsValid()); Assert.True(empty.IsEmpty()); Assert.False(empty.IsPoint()); Assert.True(full.IsValid()); Assert.True(full.IsFull()); Assert.False(full.IsPoint()); // Check that the default S2LatLngRect is identical to Empty(). S2LatLngRect default_empty = S2LatLngRect.Empty; Assert.True(default_empty.IsValid()); Assert.True(default_empty.IsEmpty()); Assert.Equal(empty.Lat, default_empty.Lat); Assert.Equal(empty.Lng, default_empty.Lng); }