BlindPrediction.Program.WorldToMiniMap C# (CSharp) Метод

WorldToMiniMap() статический приватный Метод

static private WorldToMiniMap ( System.Vector3 Pos ) : System.Vector2
Pos System.Vector3
Результат System.Vector2
        static Vector2 WorldToMiniMap(Vector3 Pos)
        {
            float MapLeft = -8000;
            float MapTop = 7350;
            float MapRight = 7500;
            float MapBottom = -7200;
            float MapWidth = Math.Abs(MapLeft - MapRight);
            float MapHeight = Math.Abs(MapBottom - MapTop);

            float _x = Pos.X - MapLeft;
            float _y = Pos.Y - MapBottom;

            float dx, dy, px, py;
            if (Math.Round((float)Drawing.Width / Drawing.Height, 1) >= 1.7) {
                dx = 272f / 1920f * Drawing.Width;
                dy = 261f / 1080f * Drawing.Height;
                px = 11f / 1920f * Drawing.Width;
                py = 11f / 1080f * Drawing.Height;
            } else if (Math.Round((float)Drawing.Width / Drawing.Height, 1) >= 1.5){
                dx = 267f / 1680f * Drawing.Width;
                dy = 252f / 1050f * Drawing.Height;
                px = 10f / 1680f * Drawing.Width;
                py = 11f / 1050f * Drawing.Height;
            } else {
                dx = 255f / 1280f * Drawing.Width;
                dy = 229f / 1024f * Drawing.Height;
                px = 6f / 1280f * Drawing.Width;
                py = 9f / 1024f * Drawing.Height;
            }
            float MinimapMapScaleX = dx / MapWidth;
            float MinimapMapScaleY = dy / MapHeight;

            float scaledX = Math.Min(Math.Max(_x * MinimapMapScaleX, 0), dx);
            float scaledY = Math.Min(Math.Max(_y * MinimapMapScaleY, 0), dy);

            float screenX = px + scaledX;
            float screenY = Drawing.Height - scaledY - py;

            return new Vector2((float)Math.Floor(screenX), (float)Math.Floor(screenY));
        }