zoukankan      html  css  js  c++  java
  • WPF 折线/坐标点的绘制 基于序列重要点的时间序列分割算法代码实现

    论文的中心内容是:

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

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

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

    给出地址: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;
                }
            }

    源代码地址

  • 相关阅读:
    Admin注册和路由分发详解
    自定义Xadmin
    苑昊老师的博客
    pip 国内源 配置
    Django模型层(2)
    Django 中间件
    Django form表单
    整理的最全 python常见面试题(基本必考)
    AJAX
    Cookie、Session和自定义分页
  • 原文地址:https://www.cnblogs.com/T-ARF/p/14618396.html
Copyright © 2011-2022 走看看