|
@@ -1543,18 +1543,19 @@ namespace HOZProject
|
|
|
//排列数
|
|
|
int rag = Convert.ToInt32(txtarray.Text);
|
|
|
//间距
|
|
|
- double dist = Convert.ToDouble(txtdistance.Text);
|
|
|
+ float dist = Convert.ToSingle(txtdistance.Text);
|
|
|
//中心点x,y轴坐标
|
|
|
- double cx = Convert.ToDouble(txtx.Text);
|
|
|
- double cy = Convert.ToDouble(txty.Text);
|
|
|
+ float cx = Convert.ToSingle(txtx.Text);
|
|
|
+ float cy = Convert.ToSingle(txty.Text);
|
|
|
+ //所有点集合
|
|
|
+ List<PointF> ptfs = new List<PointF>();
|
|
|
+ ptfs = AnalysisPosition(cx, cy, Convert.ToSingle(txtsample1x.Text),
|
|
|
+ Convert.ToSingle(txtsample1y.Text), dist, rag);
|
|
|
|
|
|
- AnalysisPosition(cx, cy, Convert.ToDouble(txtsample1x.Text),
|
|
|
- Convert.ToDouble(txtsample1y.Text), dist, rag, ref xpoints,ref ypoints);
|
|
|
-
|
|
|
- for(int i=0;i<xpoints.Count;i++)
|
|
|
+ for(int i=0;i<ptfs.Count;i++)
|
|
|
{
|
|
|
- chart1.Series[0].Points.AddXY(xpoints[i], ypoints[i]);
|
|
|
- chart1.Series[0].Points[chart1.Series[0].Points.Count - 1].Label = xpoints[i].ToString("0.000") + "," + ypoints[i].ToString("0.000");
|
|
|
+ chart1.Series[0].Points.AddXY(ptfs[i].X, ptfs[i].Y);
|
|
|
+ chart1.Series[0].Points[chart1.Series[0].Points.Count - 1].Label = ptfs[i].X.ToString("0.000") + "," + ptfs[i].Y.ToString("0.000");
|
|
|
}
|
|
|
////求样品1的水平角度
|
|
|
//double angle = 0;
|
|
@@ -1617,14 +1618,14 @@ namespace HOZProject
|
|
|
/// <param name="rag">行、列数</param>
|
|
|
/// <param name="ptsx">计算生成所有X轴坐标</param>
|
|
|
/// <param name="ptsy">计算生成所有Y轴坐标</param>
|
|
|
- public void AnalysisPosition(Double centerX,Double centerY,Double firstX,Double firstY,Double distance,int rag,ref List<Double> ptsx,ref List<Double> ptsy)
|
|
|
+ public List<PointF> AnalysisPosition(float centerX, float centerY, float firstX, float firstY,float distance,int rag)
|
|
|
{
|
|
|
//求样品1的水平角度
|
|
|
double angle = 0;
|
|
|
|
|
|
//清空所有点信息
|
|
|
- ptsx.Clear();
|
|
|
- ptsy.Clear();
|
|
|
+ List<float> ptsx = new List<float>();
|
|
|
+ List<float> ptsy = new List<float>();
|
|
|
//将第一个点加入到点信息中
|
|
|
ptsx.Add(firstX);
|
|
|
ptsy.Add(firstY);
|
|
@@ -1637,27 +1638,37 @@ namespace HOZProject
|
|
|
angle = 45 - angle;
|
|
|
angle = angle * Math.PI / 180;
|
|
|
|
|
|
- double tx = 0;
|
|
|
- double ty = 0;
|
|
|
+ float tx = 0;
|
|
|
+ float ty = 0;
|
|
|
for (int j = 0; j < rag; j++)
|
|
|
{
|
|
|
//计算每行第一个点的坐标
|
|
|
if (j > 0)
|
|
|
{
|
|
|
- tx = distance * j * Math.Sin(angle);
|
|
|
- ty = distance * j * Math.Cos(angle);
|
|
|
+ tx = (float)(distance * j * Math.Sin(angle));
|
|
|
+ ty = (float)(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);
|
|
|
+ tx = (float)(distance * i * Math.Cos(angle));
|
|
|
+ ty = (float)(distance * i * Math.Sin(angle));
|
|
|
ptsx.Add(tx + ptsx[j * rag]);
|
|
|
ptsy.Add(ty + ptsy[j * rag]);
|
|
|
}
|
|
|
}
|
|
|
+ List<PointF> pts = new List<PointF>();
|
|
|
+ for (int i=0;i<ptsx.Count;i++)
|
|
|
+ {
|
|
|
+ //增加的点
|
|
|
+ PointF pf = new PointF();
|
|
|
+ pf.X = ptsx[i];
|
|
|
+ pf.Y = ptsy[i];
|
|
|
+ pts.Add(pf);
|
|
|
+ }
|
|
|
+ return pts;
|
|
|
}
|
|
|
|
|
|
|