|
@@ -1597,6 +1597,50 @@ namespace HOZProject
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public void AnalysisPosition(Double centerX,Double centerY,Double firstX,Double firstY,Double distance,int rag,ref List<Double> ptsx,ref List<Double> ptsy)
|
|
|
+ {
|
|
|
+ //求样品1的水平角度
|
|
|
+ double angle = 0;
|
|
|
+
|
|
|
+ //清空所有点信息
|
|
|
+ ptsx.Clear();
|
|
|
+ ptsy.Clear();
|
|
|
+ //将第一个点加入到点信息中
|
|
|
+ ptsx.Add(firstX);
|
|
|
+ ptsy.Add(firstY);
|
|
|
+
|
|
|
+ //计算第一个点与X轴的交角度数
|
|
|
+ angle = Math.Atan2(ptsy[0] - centerY, centerX - ptsx[0]) * 180 / Math.PI;
|
|
|
+
|
|
|
+ //这里是求与第一个点横向排列的其他点的移动角度
|
|
|
+ //就是按45度向左向右移动的度
|
|
|
+ angle = 45 - angle;
|
|
|
+ angle = angle * Math.PI / 180;
|
|
|
+
|
|
|
+ double tx = 0;
|
|
|
+ double ty = 0;
|
|
|
+ for (int j = 0; j < rag; j++)
|
|
|
+ {
|
|
|
+ //计算每行第一个点的坐标
|
|
|
+ if (j > 0)
|
|
|
+ {
|
|
|
+ tx = distance * j * Math.Sin(angle);
|
|
|
+ ty = distance * j * Math.Cos(angle);
|
|
|
+ ptsx.Add(tx + ptsx[0]);
|
|
|
+ ptsy.Add(ptsy[0] - ty);
|
|
|
+ }
|
|
|
+ //计算每行其他点的坐标
|
|
|
+ for (int i = 1; i < rag; i++)
|
|
|
+ {
|
|
|
+ tx = distance * i * Math.Cos(angle);
|
|
|
+ ty = distance * i * Math.Sin(angle);
|
|
|
+ ptsx.Add(tx + ptsx[j * rag]);
|
|
|
+ ptsy.Add(ty + ptsy[j * rag]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
private void btn30_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
txtsample1x.Text = "21.7";
|