public SlicerRecord(HalfSlicerRecord s1)
 {
     this.pointInfoList = s1.pointInfoList;
     this.lineList      = s1.lineList;
     if (this.lineList.Count < this.pointInfoList.Count)
     {
         this.lineList.Add(new Lineindex());
     }
     this.lineList     = RebuildLineList();
     this.slicerCenter = ComputeCenter();
     this.slicerNormal = s1.slicerNormal;
     this.radius       = EvaluateRadius();
 }
        public static HalfSlicerRecord operator+(HalfSlicerRecord h1, HalfSlicerRecord h2)
        {
            if (h1.lineList == null || h2.lineList == null)
            {
                return(null);
            }
            HalfSlicerRecord ret = new HalfSlicerRecord();

            ret.slicerNormal  = (h1.slicerNormal + h2.slicerNormal).Normalize();
            ret.pointInfoList = new List <PointRecord>(h1.pointInfoList.GetRange(0, h1.pointInfoList.Count - 1));
            ret.pointInfoList.AddRange(h2.pointInfoList);
            ret.lineList = new List <Lineindex>(h1.lineList);
            ret.lineList.AddRange(h2.lineList);

            return(ret);
        }
        public SlicerRecord CombineHalfSlicer(HalfSlicerRecord inHalfSlicer)  // 和 + 不同的是可能会遇见反向的序列
        {
            if (inHalfSlicer.lineList == null || this.lineList == null)
            {
                return(null);
            }
            int keyStartFI = pointInfoList[0].adjFF.ToArray()[0];
            int keyEndFI   = pointInfoList[pointInfoList.Count - 1].adjFF.ToArray()[0];

            this.slicerNormal = (this.slicerNormal + inHalfSlicer.slicerNormal).Normalize();
            this.slicerCenter = 0.5 * (this.pointInfoList[0].p + this.pointInfoList[pointInfoList.Count - 1].p);
            if (keyEndFI == inHalfSlicer.pointInfoList[0].adjFF.ToArray()[0])  // head encounter
            {
                this.pointInfoList.RemoveAt(pointInfoList.Count - 1);
                this.pointInfoList.AddRange(inHalfSlicer.pointInfoList);
                this.lineList.AddRange(inHalfSlicer.lineList);
                this.lineList = base.RebuildLineList();
                this.pointInfoList.RemoveAt(pointInfoList.Count - 1);  // remove twice to make a slicerRecord
                return(this);
            }
            else if (keyStartFI == inHalfSlicer.pointInfoList[0].adjFF.ToArray()[0]) // need Reverse
            {
                this.pointInfoList.RemoveAt(pointInfoList.Count - 1);
                this.pointInfoList.Reverse();
                this.lineList.Reverse();
                this.pointInfoList.AddRange(inHalfSlicer.pointInfoList);
                this.lineList.AddRange(inHalfSlicer.lineList);
                this.lineList = base.RebuildLineList();
                this.pointInfoList.RemoveAt(pointInfoList.Count - 1);
                return(this);
            }
            else
            {
                throw new Exception("Slicer dont meet");
            }
        }