OpenRA.Map.CenterOfCell C# (CSharp) Метод

CenterOfCell() публичный Метод

public CenterOfCell ( OpenRA.CPos cell ) : OpenRA.WPos
cell OpenRA.CPos
Результат OpenRA.WPos
        public WPos CenterOfCell(CPos cell)
        {
            if (Grid.Type == MapGridType.Rectangular)
                return new WPos(1024 * cell.X + 512, 1024 * cell.Y + 512, 0);

            // Convert from isometric cell position (x, y) to world position (u, v):
            // (a) Consider the relationships:
            //  - Center of origin cell is (512, 512)
            //  - +x adds (512, 512) to world pos
            //  - +y adds (-512, 512) to world pos
            // (b) Therefore:
            //  - ax + by adds (a - b) * 512 + 512 to u
            //  - ax + by adds (a + b) * 512 + 512 to v
            var z = Height.Contains(cell) ? 512 * Height[cell] : 0;
            return new WPos(512 * (cell.X - cell.Y + 1), 512 * (cell.X + cell.Y + 1), z);
        }