首页 > 编程语言 > 详细

WPF 折线/坐标点的绘制 基于序列重要点的时间序列分割算法代码实现

时间:2021-04-05 17:31:08      阅读:17      评论:0      收藏:0      [点我收藏+]

论文的中心内容是:

重要点的判断方式是基于垂直距离最大值,同样和道格拉斯普克算法有一个限定值。

分段过程也是基于第一个找出的点并由此遍历的过程。

具体论文要搜索:基于序列重要点的时间序列分割

给出地址:https://www.docin.com/p-110929153.html

是我理解错了吗?怎么感觉和道格拉斯普克的算法好像....

同样是可以应用与折线图的绘制,在大量点的情况下,绘制较为困难时可以用的算法

 

截图

技术分享图片

 

关键几个地方

   public class SIP
        {
        
            public static double Distance(Point start, Point end, Point x)
            {
                double restult = Math.Abs(start.Y + (end.X - start.X) * ((x.X - start.X) / (end.X - start.X)) - x.Y);
                return restult;
            }

            public static void Segment(List<Point> list, int start, int end, double e, ref List<int> ns)
            {
               
                double maxvalue = 0;
                int index = 0;
                for (int i = start; i < end; i++)
                {
                    var val = Distance(list[start], list[end], list[i]);
                    //和DP一样的过程,具体计算不太一样
                    if (val > maxvalue)
                    {
                        maxvalue = val;
                        index = i;
                    }
                }
                if (maxvalue > e && index != 0)
                {
                    ns.Add(index);
                    //遍历添加
                    Segment(list, start, index, e, ref ns);
                    Segment(list, index, end, e, ref ns);
                }

              
            }
    
            public static List<Point> BSIP(List<Point> list, double e)
            {
                List<Point> BSIPList = new List<Point>();

                List<int> ns = new List<int>();
                //默认添加首点和尾点
                BSIPList.Add(list[0]);
                //遍历分割
                Segment(list, 0, list.Count - 1, e, ref ns);
                ns.Sort();
                foreach (var item in ns)
                {
                    BSIPList.Add(list[item]);
                }
                //默认添加首点和尾点
                BSIPList.Add(list.Last());
                return BSIPList;
            }
        }

 

源代码地址

WPF 折线/坐标点的绘制 基于序列重要点的时间序列分割算法代码实现

原文:https://www.cnblogs.com/T-ARF/p/14618396.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!