protected void DrawUnit(System.Drawing.Graphics graphics, Common.Motion.Unit unit, Color color)
        {
            var     cyl = (Common.Bounding.Cylinder)unit.LocalBounding;
            Vector3 pos = WorldToScreen(new Vector3(unit.Position.X, unit.Position.Y, 0));

            var pen = new Pen(color);

            graphics.DrawEllipse(pen, pos.X - cyl.Radius, pos.Y - cyl.Radius, 2f * cyl.Radius, 2f * cyl.Radius);
            Vector3 a = WorldToScreen(unit.Position);
            Vector3 b = WorldToScreen(unit.Position +
                                      Common.Math.Vector3FromAngleXY(Common.Math.AngleFromQuaternionUnitZ(unit.Rotation)) * cyl.Radius);

            graphics.DrawLine(pen, a.X, a.Y, b.X, b.Y);
        }
        public View()
        {
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);

            Simulation = new Common.Motion.Simulation();

            //tempNPC = new Common.Motion.NPC
            //{
            //    Position = new Vector3(20, 20, 0),
            //    Orientation = (float)Math.PI/2f,
            //    RunVelocity = new Vector2(100, 100),
            //    SteeringEnabled = true,
            //    RunSpeed = 50f,
            //    LocalBounding = new Common.Bounding.Cylinder
            //    {
            //        Radius = 10,
            //        Position = new Vector3(0, 0, 0.001f)
            //    }
            //};
            //Simulation.Insert(tempNPC);
            var tempUnit = new Common.Motion.Unit
            {
                Position      = new Vector3(20, 20, 0),
                RunVelocity   = new Vector2(20, 20),
                LocalBounding = new Common.Bounding.Cylinder
                {
                    Height = 1f,
                    Radius = 10f
                }
            };

            var ground = new Common.Motion.Static
            {
                Position      = Vector3.Zero,
                LocalBounding = new BoundingBox(new Vector3(-1000, -1000, -1), new Vector3(1000, 1000, -0.00001f))
            };

            Simulation.Insert(ground);

            timer          = new Timer();
            timer.Tick    += new EventHandler(timer_Tick);
            timer.Interval = 1000 / 60;
            timer.Enabled  = true;
        }
        public View()
        {
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);

            Simulation = new Common.Motion.Simulation();

            //tempNPC = new Common.Motion.NPC
            //{
            //    Position = new Vector3(20, 20, 0),
            //    Orientation = (float)Math.PI/2f,
            //    RunVelocity = new Vector2(100, 100),
            //    SteeringEnabled = true,
            //    RunSpeed = 50f,
            //    LocalBounding = new Common.Bounding.Cylinder
            //    {
            //        Radius = 10,
            //        Position = new Vector3(0, 0, 0.001f)
            //    }
            //};
            //Simulation.Insert(tempNPC);
            var tempUnit = new Common.Motion.Unit
            {
                Position = new Vector3(20, 20, 0),
                RunVelocity = new Vector2(20, 20),
                LocalBounding = new Common.Bounding.Cylinder
                {
                    Height = 1f,
                    Radius = 10f
                }
            };

            var ground = new Common.Motion.Static
            {
                Position = Vector3.Zero,
                LocalBounding = new BoundingBox(new Vector3(-1000, -1000, -1), new Vector3(1000, 1000, -0.00001f))
            };
            Simulation.Insert(ground);

            timer = new Timer();
            timer.Tick += new EventHandler(timer_Tick);
            timer.Interval = 1000 / 60;
            timer.Enabled = true;
        }
 protected void DrawUnit(System.Drawing.Graphics graphics, Common.Motion.Unit unit)
 {
     DrawUnit(graphics, unit, Color.Orange);
 }