예제 #1
0
        public void LeftPosProcess(VisionImage visionImage, Bitmap bitmap)
        {
            switch (Config.Instance.CurrentProductType)
            {
            case "Special_Shape":
                LeftPos.ProcessImage(visionImage, frmAAVision.LeftOffset);
                break;

            case "Rectangle":
                LeftPos.RectLeftPos(visionImage, frmAAVision.LeftOffset);
                break;

            default:
                break;
            }
            SendCmd = LeftPos.LeftCali;
            PosCheck_C(bitmap, frmAAVision.acq.hWindowControl3.HalconWindow, LeftPos.LeftCaliArrary);

            if (frmAAVision.acq.SaveImage)
            {
                SaveImage.SaveResult(frmAAVision.acq.hWindowControl3.HalconWindow, "C3");
            }
            ReceiveCmd = "";
        }
예제 #2
0
        private static void Drawing_OnDraw(EventArgs args)
        {
            if (QTarget == null)
            {
                return;
            }

            if (startPos != Vector2.Zero && LeftPos != Vector2.Zero)
            {
                Drawing.DrawLine(startPos.To3D().WorldToScreen(), LeftPos.To3D().WorldToScreen(), 2, System.Drawing.Color.White);
            }
            if (startPos != Vector2.Zero && RightPos != Vector2.Zero)
            {
                Drawing.DrawLine(startPos.To3D().WorldToScreen(), RightPos.To3D().WorldToScreen(), 2, System.Drawing.Color.White);
            }

            /*Vector2 startPosition = vel.Position.To2D() + new Vector2(0, 0f);
             *
             * for (int angle = 0; angle < 360; angle += 15)
             * {
             *  for (int i = 1; i <= numQDivideTimes; i++)
             *  {
             *      Obj_AI_Base enemyHitWithInitialQ = null,
             *          enemyHitWithLeftQSplit = null,
             *          enemyHitWithRightQSplit = null;
             *
             *      Vector2 Q1ExtendingPosition = startPosition + new Vector2(0, (Q.Range / numQDivideTimes) * i),
             *          RotatedPosition = Q1ExtendingPosition.RotateAroundPoint(startPosition, (float)(angle * Math.PI / 180)),
             *          EndOfQPosition = getEndOfMissilePosition(startPosition, RotatedPosition, i, out enemyHitWithInitialQ);
             *
             *      //if the linear spell hits the target, don't check branching
             *      if (enemyHitWithInitialQ == target)
             *      {
             *          Drawing.DrawLine(startPosition.To3D().WorldToScreen(), EndOfQPosition.To3D().WorldToScreen(), 2, System.Drawing.Color.White);
             *
             *          //don't check the next 5 points in the Q range (based off the dividend)
             *          i += numQDivideTimes;
             *      }
             *      //if the linear spell doesn't hit the target, find the perp angles and calculate them.
             *      else
             *      {
             *          Vector2 PerpendicularPos1 = EndOfQPosition.Perpendicular(),
             *              PerpendicularPos2 = startPosition.Perpendicular(),
             *              temp = new Vector2(EndOfQPosition.X - PerpendicularPos1.X, EndOfQPosition.Y - PerpendicularPos1.Y),
             *              PerpendicularPos3 = EndOfQPosition.Perpendicular2(),
             *              PerpendicularPos4 = startPosition.Perpendicular2(),
             *              temp2 = new Vector2(EndOfQPosition.X - PerpendicularPos3.X, EndOfQPosition.Y - PerpendicularPos3.Y),
             *              QLeftSplitPos = PerpendicularPos2 + temp,
             *              QRightSplitPos = PerpendicularPos4 + temp2;
             *
             *          QLeftSplitPos = getEndOfMissilePosition(EndOfQPosition, QLeftSplitPos, target, out enemyHitWithLeftQSplit);
             *          QRightSplitPos = getEndOfMissilePosition(EndOfQPosition, QRightSplitPos, target, out enemyHitWithRightQSplit);
             *
             *          //draw the point to cast to and the point to branch at for left side
             *          if (enemyHitWithLeftQSplit == target)
             *          {
             *              Drawing.DrawLine(EndOfQPosition.To3D().WorldToScreen(), QLeftSplitPos.To3D().WorldToScreen(), 2, System.Drawing.Color.White);
             *              Drawing.DrawLine(startPosition.To3D().WorldToScreen(), EndOfQPosition.To3D().WorldToScreen(), 2, System.Drawing.Color.White);
             *          }
             *          //draw the point to cast to and the point to branch at for right side
             *          else if (enemyHitWithRightQSplit == target)
             *          {
             *              Drawing.DrawLine(EndOfQPosition.To3D().WorldToScreen(), QRightSplitPos.To3D().WorldToScreen(), 2, System.Drawing.Color.White);
             *              Drawing.DrawLine(startPosition.To3D().WorldToScreen(), EndOfQPosition.To3D().WorldToScreen(), 2, System.Drawing.Color.White);
             *          }
             *      }
             *  }
             * }*/
        }