Ejemplo n.º 1
0
        private Vector2 ScreenFromWorld(Vector2 position, ICameraModel2D cam)
        {
            var worldFocusToPoint          = position - cam.GetWorldFocus();
            var rotatedToScreenOrientation = Utility.Geometry.RotateVectorClockwise(worldFocusToPoint, -cam.GetWorldClockwiseRotationRadsFromPositiveY());

            return(rotatedToScreenOrientation * cam.GetWorldZoom());
        }
Ejemplo n.º 2
0
        private Vector2 WorldFromScreen(Vector2 position, ICameraModel2D cam)
        {
            var up    = cam.GetWorldUp();
            var right = new Vector2(up.Y, -up.X);

            position /= cam.GetWorldZoom();
            var shiftFromFocus = (position.X * right) + (position.Y * up);

            return(cam.GetWorldFocus() + shiftFromFocus);
        }