/// <summary>
/// 根据指定距离分割折线
/// </summary>
/// <param name="coords">折线坐标,长度为2*n</param>
/// <param name="result">返回的分段节点坐标</param>
/// <param name="length">指定分割长度</param>
private void CalSplitPoints(double[] coords, ref double[] result, double length)
{
int size=coords.Length/2;
double[] lengths = new double[size];
double totalLength = 0;
int i;
lengths[0] = 0;
for (i = 1; i < size; i++)
{
int tempI = 2 * (i-1);
lengths[i] = Math.Sqrt((coords[tempI + 2] - coords[tempI]) * (coords[tempI + 2] - coords[tempI])
+ (coords[tempI + 3] - coords[tempI + 1]) * (coords[tempI + 3] - coords[tempI + 1]));
totalLength += lengths[i];
}
axis = new double[2 * (int)(totalLength / length) + 2];
int count = axis.Length / 2;
int currentI = -1;
double currentL = 0;
double tempLengths=0;
axis[0] = coords[0]; axis[1] = coords[1];
for (i = 1; i < count; i++)
{
currentL = (i-1) * length;
while ((currentL + length) > tempLengths)
{
if (currentI == size - 1)
{
break;
}
currentI++;
tempLengths += lengths[currentI];
}
double lastLength = tempLengths - lengths[currentI];
double nowLength = currentL + length - lastLength;
//nowLength为点currentI-1和currentI两点间离点currentI-1的距离
double ratio = nowLength / lengths[currentI];
int tempI = 2 * (currentI-1);
axis[2 * i] = ratio * (coords[tempI + 2] - coords[tempI]) + coords[tempI];
axis[2 * i+1] = ratio * (coords[tempI + 3] - coords[tempI+1]) + coords[tempI+1];
}
}
分享到:
相关推荐
EXCEL报表折线图-16-双重水平分割折线图.xlsx
Excel模板16-双重水平分割折线图.zip
根据excel内容画折线图和柱状图,具体可参考:https://blog.csdn.net/u010637291/article/details/117189249(其对应的代码和数据)
为实现图像较为精确的分割,充分考虑边界的影响,从二维线阈值分割替代传统的点阈值分割思想出发,提出了折线阈值型Otsu法。该方法以对边界信息的迭代分割的手段获得实际用于分割的二维折线阈值。仿真结果表明,该...
将一条折线,等距离偏移一定距离。 把屏幕坐标转换为GIS坐标,可以在地图上偏移折线
Excel折线图面积图模板-双重水平分割折线图
Jquery根据table数据画折线图\柱状图\圆饼图
Jquery根据table提供的数据绘画折线图,柱状图,圆饼图。希望对你有用。我
折线、双Y轴、不交叉、highcharts、按照日期分割线 折线、双Y轴、不交叉、highcharts、按照日期分割线
R语言新手,小白绘制好看的折线图,希望有所帮助
折线图
jfreechart的简单使用,jfreechart根据24小时数据画折线图。自定义x轴y轴刻度,时间间隔为1小时且以整点为折点画折线图。
折线图绘制折线图绘制折线图绘制折线图绘制折线图绘制折线图绘制折线图绘制折线图绘制折线图绘制折线图绘制折线图绘制折线图绘制折线图绘制折线图绘制折线图绘制折线图绘制折线图绘制折线图绘制折线图绘制折线图绘制...
Android studio实现折线图
echarts温度折线统计图 echarts温度折线统计图 echarts温度折线统计图 echarts温度折线统计图
VC画折线图小程序说明读取原始数据,用于生成两种折线图即可。 单个测点生成单点显示折线图时,能够调整折线图上的点,并将调整后点对应的值保存回原文件。
年月日产量折线图 年月日产量折线图 年月日产量折线图 年月日产量折线图 年月日产量折线图 年月日产量折线图
qt qml c++ 折线图