public void Test_R2Rect_FromPoint() { // FromPoint(), FromPointPair() R2Rect d1 = new(new R2Point(0.1, 0), new R2Point(0.25, 1)); Assert.Equal(new R2Rect(d1.Lo(), d1.Lo()), R2Rect.FromPoint(d1.Lo())); Assert.Equal(new R2Rect(new R2Point(0.15, 0.3), new R2Point(0.35, 0.9)), R2Rect.FromPointPair(new R2Point(0.15, 0.9), new R2Point(0.35, 0.3))); Assert.Equal(new R2Rect(new R2Point(0.12, 0), new R2Point(0.83, 0.5)), R2Rect.FromPointPair(new R2Point(0.83, 0), new R2Point(0.12, 0.5))); }
private static void CompareS2CellToPadded(S2Cell cell, S2PaddedCell pcell, double padding) { Assert.Equal(cell.Id, pcell.Id); Assert.Equal(cell.Level, pcell.Level); Assert.Equal(padding, pcell.Padding); Assert.Equal(cell.BoundUV.Expanded(padding), pcell.Bound); var center_uv = cell.Id.CenterUV(); Assert.Equal(R2Rect.FromPoint(center_uv).Expanded(padding), pcell.Middle); Assert.Equal(cell.Center(), pcell.GetCenter()); }