private void DrawGoals(Graphics g)
        {
            Point[] uprights = new Point[8];
            for (int i = 0; i < 4; ++i)
            {
                Coords temp = StaticMathFunctions.SpacePointToDisplayPointTransform(Constants.Uprights[i]);
                uprights[i] = new Point((Int32)(temp.X * _zoom), (Int32)(temp.Y * _zoom));
            }

            double zmultiplierTop    = 0.5 + 0.5 * StaticMathFunctions.SpacePointToDisplayPointZAxis(Constants.GoalTop);
            double zmultiplierBottom = 0.5 + 0.5 * StaticMathFunctions.SpacePointToDisplayPointZAxis(Constants.GoalBottom);

            uprights[4] = new Point(uprights[0].X, (Int32)(uprights[0].Y - Constants.GoalHeight * zmultiplierTop * _zoom));
            uprights[5] = new Point(uprights[1].X, (Int32)(uprights[1].Y - Constants.GoalHeight * zmultiplierBottom * _zoom));
            uprights[6] = new Point(uprights[2].X, (Int32)(uprights[2].Y - Constants.GoalHeight * zmultiplierTop * _zoom));
            uprights[7] = new Point(uprights[3].X, (Int32)(uprights[3].Y - Constants.GoalHeight * zmultiplierBottom * _zoom));

            Pen drawPen = new Pen(Color.Red);

            // Uprights
            g.DrawLine(drawPen, uprights[0], uprights[4]);
            g.DrawLine(drawPen, uprights[1], uprights[5]);
            g.DrawLine(drawPen, uprights[2], uprights[6]);
            g.DrawLine(drawPen, uprights[3], uprights[7]);
            // Crossbars
            g.DrawLine(drawPen, uprights[4], uprights[5]);
            g.DrawLine(drawPen, uprights[6], uprights[7]);
            drawPen.Dispose();
        }
        private void DrawNetZAxis(Graphics g, UInt16 Xposition)
        {
            Pen drawPen = new Pen(Constants.NetsColor);

            // y -axis
            for (sbyte i = 0; i <= (Constants.GoalBottom - Constants.GoalTop) / Constants.NetsSpacing; ++i)
            {
                Int32  yval        = Constants.GoalTop + i * Constants.NetsSpacing;
                Coords leftEnd     = StaticMathFunctions.SpacePointToDisplayPointTransform(Xposition, yval);
                Coords rightEnd    = StaticMathFunctions.SpacePointToDisplayPointTransform(Xposition + Constants.NetsDepth, yval);
                PointF anchorLeft  = new PointF((leftEnd.X * _zoom), (leftEnd.Y * _zoom));
                PointF anchorRight = new PointF((rightEnd.X * _zoom), (rightEnd.Y * _zoom));
                //Coords threadEnd = StaticMathFunctions.SpacePointToDisplayPointTransform(Xposition, Constants.GoalTop + i * Constants.NetsSpacing);
                double zmultiplier = 0.5 + 0.5 * StaticMathFunctions.SpacePointToDisplayPointZAxis(yval);
                float  Zoffset     = (float)(Constants.GoalHeight * _zoom * zmultiplier);

                g.DrawLine(drawPen, anchorLeft.X, anchorLeft.Y - Zoffset, anchorRight.X, anchorRight.Y - Zoffset);
            }

            // x-axis

            double zmultiplierNear = 0.5 + 0.5 * StaticMathFunctions.SpacePointToDisplayPointZAxis(Constants.GoalBottom);
            double zmultiplierFar  = 0.5 + 0.5 * StaticMathFunctions.SpacePointToDisplayPointZAxis(Constants.GoalTop);

            float ZoffsetNear = (float)(Constants.GoalHeight * _zoom * zmultiplierNear);
            float ZoffsetFar  = (float)(Constants.GoalHeight * _zoom * zmultiplierFar);

            for (sbyte i = 0; i <= Constants.NetsDepth / Constants.NetsSpacing; ++i)
            {
                Coords postNear = StaticMathFunctions.SpacePointToDisplayPointTransform(Xposition + i * Constants.NetsSpacing, Constants.GoalBottom);
                Coords postFar  = StaticMathFunctions.SpacePointToDisplayPointTransform(Xposition + i * Constants.NetsSpacing, Constants.GoalTop);

                PointF anchorNear = new PointF((postNear.X * _zoom), (postNear.Y * _zoom));
                PointF anchorFar  = new PointF((postFar.X * _zoom), (postFar.Y * _zoom));

                g.DrawLine(drawPen, anchorNear.X, anchorNear.Y - ZoffsetNear, anchorFar.X, anchorFar.Y - ZoffsetFar);
            }

            drawPen.Dispose();
        }
        private void DrawNetXAxis(Graphics g, UInt16 Xposition, UInt16 Yposition)
        {
            Pen drawPen = new Pen(Constants.NetsColor);

            double zmultiplier = 0.5 + 0.5 * StaticMathFunctions.SpacePointToDisplayPointZAxis(Yposition);
            float  Zoffset     = (float)(Constants.GoalHeight * _zoom * zmultiplier);

            // Vertical
            for (sbyte i = 0; i <= (Constants.NetsDepth) / Constants.NetsSpacing; ++i)
            {
                //Int32 yval = Constants.GoalTop + i * Constants.NetsSpacing;
                Coords threadStart = StaticMathFunctions.SpacePointToDisplayPointTransform(Xposition + i * Constants.NetsSpacing, Yposition);
                PointF anchor      = new PointF((threadStart.X * _zoom), (threadStart.Y * _zoom));
                //Coords threadEnd = StaticMathFunctions.SpacePointToDisplayPointTransform(Xposition, Constants.GoalTop + i * Constants.NetsSpacing);



                g.DrawLine(drawPen, anchor.X, anchor.Y, anchor.X, anchor.Y - Zoffset);
            }

            // Horizontal
            Coords leftEnd  = StaticMathFunctions.SpacePointToDisplayPointTransform(Xposition, Yposition);
            Coords rightEnd = StaticMathFunctions.SpacePointToDisplayPointTransform(Xposition + Constants.NetsDepth, Yposition);

            PointF anchorLeft  = new PointF((leftEnd.X * _zoom), (leftEnd.Y * _zoom));
            PointF anchorRight = new PointF((rightEnd.X * _zoom), (rightEnd.Y * _zoom));

            //double zmultiplierLeft = 0.5 + 0.5 * StaticMathFunctions.SpacePointToDisplayPointZAxis(Constants.GoalBottom);
            //double zmultiplierRight = 0.5 + 0.5 * StaticMathFunctions.SpacePointToDisplayPointZAxis(Constants.GoalTop);

            for (sbyte i = 0; i <= Constants.GoalHeight / Constants.NetsSpacing; ++i)
            {
                float delataZoffset = (float)(i * Constants.NetsSpacing * _zoom * zmultiplier);
                //float ZoffsetFar = (float)(i * Constants.NetsSpacing * _zoom * zmultiplier);
                g.DrawLine(drawPen, anchorLeft.X, anchorLeft.Y - delataZoffset, anchorRight.X, anchorRight.Y - delataZoffset);
            }

            drawPen.Dispose();
        }
        private void DrawNetYAxis(Graphics g, UInt16 Xposition)
        {
            Pen drawPen = new Pen(Constants.NetsColor);

            // Vertical
            for (sbyte i = 0; i <= (Constants.GoalBottom - Constants.GoalTop) / Constants.NetsSpacing; ++i)
            {
                Int32  yval        = Constants.GoalTop + i * Constants.NetsSpacing;
                Coords threadStart = StaticMathFunctions.SpacePointToDisplayPointTransform(Xposition, yval);
                PointF anchor      = new PointF((threadStart.X * _zoom), (threadStart.Y * _zoom));
                //Coords threadEnd = StaticMathFunctions.SpacePointToDisplayPointTransform(Xposition, Constants.GoalTop + i * Constants.NetsSpacing);
                double zmultiplier = 0.5 + 0.5 * StaticMathFunctions.SpacePointToDisplayPointZAxis(yval);
                float  Zoffset     = (float)(Constants.GoalHeight * _zoom * zmultiplier);

                g.DrawLine(drawPen, anchor.X, anchor.Y, anchor.X, anchor.Y - Zoffset);
            }

            // Horizontal
            Coords postNear = StaticMathFunctions.SpacePointToDisplayPointTransform(Xposition, Constants.GoalBottom);
            Coords postFar  = StaticMathFunctions.SpacePointToDisplayPointTransform(Xposition, Constants.GoalTop);

            PointF anchorNear = new PointF((postNear.X * _zoom), (postNear.Y * _zoom));
            PointF anchorFar  = new PointF((postFar.X * _zoom), (postFar.Y * _zoom));

            double zmultiplierNear = 0.5 + 0.5 * StaticMathFunctions.SpacePointToDisplayPointZAxis(Constants.GoalBottom);
            double zmultiplierFar  = 0.5 + 0.5 * StaticMathFunctions.SpacePointToDisplayPointZAxis(Constants.GoalTop);

            for (sbyte i = 0; i <= Constants.GoalHeight / Constants.NetsSpacing; ++i)
            {
                float ZoffsetNear = (float)(i * Constants.NetsSpacing * _zoom * zmultiplierNear);
                float ZoffsetFar  = (float)(i * Constants.NetsSpacing * _zoom * zmultiplierFar);
                g.DrawLine(drawPen, anchorNear.X, anchorNear.Y - ZoffsetNear, anchorFar.X, anchorFar.Y - ZoffsetFar);
            }

            drawPen.Dispose();
        }
        private void DrawSomeBall(Graphics g, Ball someball, Image ballImage)
        {
            Coords ballPos = StaticMathFunctions.SpacePointToDisplayPointTransform(someball.Position3d.X, someball.Position3d.Y);

            Point anchor = new Point((Int32)(ballPos.X * _zoom), (Int32)(ballPos.Y * _zoom));

            Int32 radiusX = (Int32)(0.5 * ballImage.Width);
            Int32 radiusY = (Int32)(0.5 * ballImage.Height);

            double zmultiplier = 0.5 + 0.5 * StaticMathFunctions.SpacePointToDisplayPointZAxis(someball.Position3d.Y);

            Int32 Zoffset = (Int32)(someball.Position3d.Z * _zoom * zmultiplier);

            Color color            = Color.Black;
            Color TransparentColor = Color.FromArgb(150, color.R, color.G, color.B);

            // draw shadow.
            g.FillEllipse(new SolidBrush(TransparentColor), (Int32)(anchor.X - radiusX * zmultiplier), (Int32)(anchor.Y),
                          (Int32)(radiusX * 2 * zmultiplier), (Int32)(radiusY * zmultiplier));

            // draw ball
            g.DrawImage(ballImage, (float)(anchor.X - radiusX * zmultiplier), (float)(anchor.Y - (radiusY) * zmultiplier) - Zoffset,
                        (float)(2 * radiusX * zmultiplier), (float)(2 * radiusX * zmultiplier));
        }