public void Test_EncodedS2CellIdVector_FractalS2ShapeIndexCells() { S2Testing.Fractal fractal = new(); fractal.SetLevelForApproxMaxEdges(3 * 1024); S2Point center = MakePointOrDie("47.677:-122.206"); MutableS2ShapeIndex index = new(); index.Add(new S2Loop.Shape( fractal.MakeLoop(S2.GetFrame(center), S1Angle.FromDegrees(1)))); List <S2CellId> ids = new(); foreach (var shape in index.GetNewEnumerable()) { ids.Add(shape.Item1); } Assert.Equal(966, ids.Count); TestEncodedS2CellIdVector(ids, 2902); }
public void Test_S2_Frames() { var z = new S2Point(0.2, 0.5, -3.3).Normalize(); var m = S2.GetFrame(z); Assert.True(S2.ApproxEquals(m.Col(2), z)); Assert.True(m.Col(0).IsUnitLength()); Assert.True(m.Col(1).IsUnitLength()); Assert2.DoubleEqual(m.Det(), 1); Assert.True(S2.ApproxEquals(S2.ToFrame(m, m.Col(0)), new(1, 0, 0))); Assert.True(S2.ApproxEquals(S2.ToFrame(m, m.Col(1)), new(0, 1, 0))); Assert.True(S2.ApproxEquals(S2.ToFrame(m, m.Col(2)), new(0, 0, 1))); Assert.True(S2.ApproxEquals(S2.FromFrame(m, new(1, 0, 0)), m.Col(0))); Assert.True(S2.ApproxEquals(S2.FromFrame(m, new(0, 1, 0)), m.Col(1))); Assert.True(S2.ApproxEquals(S2.FromFrame(m, new(0, 0, 1)), m.Col(2))); }