/// <summary> /// Do the task function override /// </summary> /// <param name="source"></param> /// <returns></returns> public override ScanData DoTask(ScanData source) { ScanData ret = new ScanData(source.Count); UpdatePercent(0, ret); source.Sort(); int count = source.Count; //count = 2; //primitiveType = PrimitiveType.LineStrip; ScanLine top = new ScanLine(count); ScanLine bottom = new ScanLine(count); ScanLine prev = source[0]; top.Add(prev.First()); bottom.Add(prev.Last()); for (int i = 1; i <= count; i++) { if (this.CancelPending) { return(source); } ScanLine current = source[i % count]; StripResult strip = CreateStrip(prev, current); top.Add(strip.Current.First()); bottom.Add(strip.Current.Last()); prev = strip.Current; ret.Add(strip.Result); UpdatePercent((int)((100 * i) / count), ret); } if (count <= 2) { return(ret); } Point3D topcenter = Point3D.Average(top); Point3D bottomcenter = Point3D.Average(bottom); for (int i = 0; i < ret.Count; i++) { ret[i].Insert(0, topcenter); ret[i].Add(bottomcenter); AdjustNormalFromTriangleStrip(ret[i]); } UpdatePercent(100, ret); return(ret); }