コード例 #1
0
        private void WHRect(out fpoint a, out fpoint b)
        {
            fpoint uppoint;
            fpoint dwpoint;

            if (Up.y < Down.y)
            {
                uppoint = Up;
                dwpoint = Down;
            }
            else
            {
                uppoint = Down;
                dwpoint = Up;
            }

            if (uppoint.x > dwpoint.x)
            {
                double temp = dwpoint.y;
                dwpoint.y = uppoint.y;
                uppoint.y = temp;

                fpoint tmp = dwpoint;
                dwpoint = uppoint;
                uppoint = tmp;
            }

            a = uppoint;
            b = dwpoint;
        }
コード例 #2
0
ファイル: Editor.cs プロジェクト: analthief/iddqdeditor
 //переводит истинны координаты в экранные
 public Point RealToScreen(fpoint pt)
 {
     try
     {
         return(new Point(Convert.ToInt32(pt.x * rs_dx), Convert.ToInt32(pt.y * rs_dy)));
     }
     catch (Exception e)
     {
         onException("Ошибка при преобразовании координаты", e.Message);
         return(new Point());
     }
 }
コード例 #3
0
        public override double GetR(fpoint f)
        {
            fpoint a;
            fpoint b;

            WHRect(out a, out b);

            if ((f.x > a.x) && (f.y > a.y) && (f.x < b.x) && (f.y < b.y))
            {
                return(10);
            }
            return(-1);
        }
コード例 #4
0
ファイル: Editor.cs プロジェクト: analthief/iddqdeditor
        //Получает ближайшую фигуру к указанной экранной точке
        public int GetNearShape(Point pt)
        {
            fpoint fpt    = ScreenToReal(pt);
            double minval = double.MaxValue;
            double val    = 0;
            int    minsp  = -1;

            for (int i = 0; i < shapelist.Count; i++)
            {
                val = shapelist[i].GetR(fpt);
                if ((val < minval) && (val != -1))
                {
                    minval = val;
                    minsp  = i;
                }
            }

            return(minsp);
        }
コード例 #5
0
        public override double GetR(fpoint f)
        {
            fpoint bp;
            fpoint cp;

            if (fpoint.GetRasst(f, fpEnd) > fpoint.GetRasst(f, fpBeg))
            {
                bp = fpEnd - fpBeg;
                cp = f - fpBeg;
            }
            else
            {
                bp = fpBeg - fpEnd;
                cp = f - fpEnd;
            }

            double a    = fpoint.GetRasstNormalized(cp);
            double b    = fpoint.GetRasstNormalized(bp);
            double cosa = (bp.x * cp.x + bp.y * cp.y) / (a * b);
            double res  = cosa >= 0 ? Math.Sqrt(1 - cosa * cosa) * a : -1;

            return(res < 50 ? res : -1);
        }
コード例 #6
0
 //Получает расстояние от данной точки до фигуры
 public abstract double GetR(fpoint f);
コード例 #7
0
 public sRect(DelegateContainer _dlc, double x1, double y1, double x2, double y2)
     : base(_dlc)
 {
     this.Up   = new fpoint(x1, y1);
     this.Down = new fpoint(x2, y2);
 }
コード例 #8
0
 public sRect(DelegateContainer _dlc, Point Down, Point Up)
     : base(_dlc)
 {
     this.Up   = base.dlc.fScreenToReal(Down);
     this.Down = base.dlc.fScreenToReal(Up);
 }
コード例 #9
0
        public override double GetR(fpoint f)
        {
            double val = fpoint.GetRasst(Center, f);

            return(val < Radius ? val : -1);
        }
コード例 #10
0
 public sCircle(DelegateContainer _dlc, double x1, double y1, double r)
     : base(_dlc)
 {
     this.Center = new fpoint(x1, y1);
     this.Radius = r;
 }
コード例 #11
0
 public sCircle(DelegateContainer _dlc, Point Down, Point Up)
     : base(_dlc)
 {
     this.Center = base.dlc.fScreenToReal(Down);
     this.Radius = fpoint.GetRasst(base.dlc.fScreenToReal(Down), base.dlc.fScreenToReal(Up));
 }
コード例 #12
0
 public sLine(DelegateContainer _dlc, double x1, double y1, double x2, double y2)
     : base(_dlc)
 {
     fpBeg = new fpoint(x1, y1);
     fpEnd = new fpoint(x2, y2);
 }
コード例 #13
0
 public sLine(DelegateContainer _dlc, Point p1, Point p2)
     : base(_dlc)
 {
     fpBeg = base.dlc.fScreenToReal(p1);
     fpEnd = base.dlc.fScreenToReal(p2);
 }
コード例 #14
0
        public override double GetR(fpoint f)
        {
            double val = fpoint.GetRasst(this.Center, f);

            return(val < 50 ? val: -1);
        }
コード例 #15
0
 public sCross(DelegateContainer _dlc, double x, double y)
     : base(_dlc)
 {
     Center = new fpoint(x, y);
 }
コード例 #16
0
 public sCross(DelegateContainer _dlc, int x, int y)
     : base(_dlc)
 {
     Center = base.dlc.fScreenToReal(new Point(x, y));
 }