예제 #1
0
 public PointF WorldToScreen(ViewModel.Point point)
 {
     return(new PointF
     {
         X = (float)((point.X - MidWorld_.X) * scale_ + 0.5 * Width),
         Y = (float)((point.Y - MidWorld_.Y) * scale_ + 0.5 * Height),
     });
 }
예제 #2
0
        public ViewPort(int screenWidth, int screenHeight, ViewModel.Point MinWorld, ViewModel.Point MaxWorld)
        {
            Width  = screenWidth;
            Height = screenHeight;

            MinWorld_ = MinWorld;
            MaxWorld_ = MaxWorld;

            CalulateTransformation();
        }
예제 #3
0
        private void CalulateTransformation()
        {
            const double PercetageOfScreenUse = 0.9;

            scale_ = PercetageOfScreenUse * Math.Min(
                Width / (MaxWorld_.X - MinWorld_.X),
                Height / (MaxWorld_.Y - MinWorld_.Y));

            MidWorld_ = new ViewModel.Point
            {
                X = 0.5 * MinWorld_.X + 0.5 * MaxWorld_.X,
                Y = 0.5 * MinWorld_.Y + 0.5 * MaxWorld_.Y,
                Z = 0.5 * MinWorld_.Z + 0.5 * MaxWorld_.Z
            };
        }