Shuxia Ning
2024-09-26 7d8328d2f0a1c48f5cea1348cbce4c5b5c08262f
WinFrmUI/Yw.WinFrmUI.Phart.Core/01-perform/01-chart/99-calculate/Point2dListExtensions.cs
@@ -101,5 +101,28 @@
            return cubic_spline.GetPointList(point_count);
        }
        //public static List<Yw.Geometry.Point2d> GetInterPointsX(this List<Yw.Geometry.Point2d> pt_list, double y)
        //{
        //    if (pt_list == null || pt_list.Count < 2)
        //    {
        //        return default;
        //    }
        //    var list = new List<Yw.Geometry.Point2d>();
        //    for (int i = 0; i < pt_list.Count - 1; i++)
        //    {
        //        if ((y >= pt_list[i].Y && y <= pt_list[i + 1].Y) || (y <= pt_list[i].Y && y >= pt_list[i + 1].Y))
        //        {//直线插值
        //            double x;
        //            if (Math.Abs(pt_list[i].Y - pt_list[i + 1].Y) < 0.01)
        //                x = (pt_list[i].X + pt_list[i + 1].X) * 0.5;
        //            else
        //                x = pt_list[i].X + (pt_list[i + 1].X - pt_list[i].X) * (y - pt_list[i].Y) / (pt_list[i + 1].Y - pt_list[i].Y);
        //            list.Add(new Yw.Geometry.Point2d(x, y));
        //        }
        //    }
        //    return list;
        //}
    }
}