Exemplo n.º 1
0
        internal void UpdatePosition(double time, double ppmZ, double actualWidth, double actualHeight, double centerX, double centerY)
        {
            (double x, double y)             = spaceObjectData.CalculatePosition(time);
            (double canvasX, double canvasY) = Space2Canvas2ElectricBogaloo(
                time,
                ppmZ,
                x, y,
                actualWidth, actualHeight,
                centerX,
                centerY);
            Canvas.SetLeft(canvas, canvasX - ELLIPSE_SHIFT - ellipse.ActualWidth / 2);
            Canvas.SetTop(canvas, canvasY - ELLIPSE_SHIFT - ellipse.ActualHeight / 2);

            if (spaceObjectData.DadBod == null)
            {
                return;
            }
            (double dadX, double dadY)             = spaceObjectData.DadBod.CalculatePosition(time);
            (double canvasDadX, double canvasDadY) = Space2Canvas2ElectricBogaloo(
                time,
                ppmZ,
                dadX, dadY,
                actualWidth, actualHeight,
                centerX,
                centerY);
            Canvas.SetLeft(orbitEllipse, canvasDadX - orbitEllipse.ActualWidth / 2);
            Canvas.SetTop(orbitEllipse, canvasDadY - orbitEllipse.ActualHeight / 2);

            orbitEllipse.Width  = spaceObjectData.OrbitalRadius * 2 * ppmZ;
            orbitEllipse.Height = spaceObjectData.OrbitalRadius * 2 * ppmZ;
        }