Beispiel #1
0
 /// <summary>
 /// 插入点
 /// </summary>
 /// <param name="line"></param>
 public void InsertForword(LinkedLine line)
 {
     if (this.Next != null)
     {
         this.Next.Pre = line;
         line.Next     = this.Next;
     }
     this.Next = line;
     line.Pre  = this;
 }
Beispiel #2
0
        /// <summary>
        /// 查找到指定段线之前有多少节
        /// </summary>
        /// <param name="line"></param>
        /// <returns></returns>
        public int CountToLine(LinkedLine line)
        {
            int i  = 1;
            var cu = this;

            while (cu.Next != null && cu.Next != line)
            {
                i++;
                cu = cu.Next;
            }
            i++;
            return(i);
        }
Beispiel #3
0
 /// <summary>
 /// 向前连接
 /// </summary>
 /// <param name="line"></param>
 public void LinkForword(LinkedLine line)
 {
     this.Next = line;
     line.Pre  = this;
 }
Beispiel #4
0
        /// <summary>
        /// 从上一次参与计算的参考线段到现在为止查找交点
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <param name="minK">上一格网点在哪个参考线上求的</param>
        /// <param name="crossK"></param>
        /// <param name="crossLine">与具体哪根参考线有交点</param>
        /// <returns></returns>
        public bool TryGetCross(double a, double b, double minK, double maxK, out double crossK, out LinkedLine crossLine)
        {
            //标记在哪个线段上求交的
            crossLine = this;
            crossK    = (b - this.B) / (this.A - a);
            if (crossK >= StartK && crossK < maxK)
            {
                return(true);
            }
            if (Math.Abs(crossK - StartK) < 1e-15 || Math.Abs(crossK - maxK) < InvaluedValue)
            {
                return(true);
            }

            while (crossLine.Pre != null && crossLine.Pre.EndK >= minK)
            {
                crossLine = crossLine.Pre;

                crossK = (b - crossLine.B) / (crossLine.A - a);
                if (crossK >= crossLine.StartK && crossK <= crossLine.EndK)
                {
                    return(true);
                }

                if (Math.Abs(crossK - crossLine.StartK) < 1e-15 || Math.Abs(crossK - crossLine.EndK) < InvaluedValue)
                {
                    return(true);
                }
            }
            return(false);
        }