Exemple #1
0
        public Tuple <double, double> Angle_point()
        {
            double x1 = A.GetPoint().X - B.GetPoint().X, x2 = C.GetPoint().X - B.GetPoint().X;
            double y1 = A.GetPoint().Y - B.GetPoint().Y, y2 = C.GetPoint().Y - B.GetPoint().Y;
            var    d1  = Math.Sqrt(x1 * x1 + y1 * y1);
            var    d2  = Math.Sqrt(x2 * x2 + y2 * y2);
            var    anl = Math.Acos((x1 * x2 + y1 * y2) / (d1 * d2)) * 180 / Math.PI;

            return(Tuple.Create(anl, (x1 * x2 + y1 * y2) / (d1 * d2)));
        }
Exemple #2
0
        private IEnumerable <int> FindTouchedList(PointListItem self)
        {
            var res = new List <int>();

            if (self == null)
            {
                return(res);
            }

            var nbs = m_OrigItems.OrderBy(x => x.GetDistance(self.GetPoint())).Take(4).ToList();

            foreach (var itm in nbs)
            {
                if (self.IsTouched(itm))
                {
                    res.Add(itm.Id());
                }
            }

            return(res);
        }
Exemple #3
0
 public bool IsTouched(PointListItem a)
 {
     return(GetDistance(a.GetPoint()) - (m_Radius + a.GetRadius()) < 5);
 }