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;
                }
            }

    源代码地址

  • 相关阅读:
    22 组合电路中的竞争--冒险
    21 典型的组合电路模块(2)
    vhdl和verilog的区别
    17 TTL电路系列(2)
    树莓派Pico
    ESP8266/ESP32自动下载电路原理分析
    CH340芯片
    26. 删除排序数组中的重复项
    25. K 个一组翻转链表
    23. 合并K个排序链表
  • 原文地址:https://www.cnblogs.com/T-ARF/p/14618396.html
Copyright © 2011-2022 走看看