foreach (KeyValuePair<string, List<string>> kvp in StrXZPointLocatiton_OKL)
{
//1.求原点坐标点
//三个点组成的三角形ABC,直角的点作为坐标系原点
string PointAx = kvp.Value[0].Split(',')[0]; string PointAy = kvp.Value[0].Split(',')[1]; string PointAz = kvp.Value[0].Split(',')[2]; string PointAu = kvp.Value[0].Split(',')[3];
string PointBx = kvp.Value[1].Split(',')[0]; string PointBy = kvp.Value[1].Split(',')[1]; string PointBz = kvp.Value[1].Split(',')[2]; string PointBu = kvp.Value[1].Split(',')[3];
string PointCx = kvp.Value[2].Split(',')[0]; string PointCy = kvp.Value[2].Split(',')[1]; string PointCz = kvp.Value[2].Split(',')[2]; string PointCu = kvp.Value[2].Split(',')[3];
//string PointDx = kvp.Value[3].Split(',')[0]; string pointDy = kvp.Value[3].Split(',')[1]; string PointDz = kvp.Value[3].Split(',')[2]; string PointDu = kvp.Value[3].Split(',')[3];
double LenAB = Math.Pow((double.Parse(PointAx) - double.Parse(PointBx)), 2) + Math.Pow((double.Parse(PointAy) - double.Parse(PointBy)), 2);
double LenBC = Math.Pow((double.Parse(PointBx) - double.Parse(PointCx)), 2) + Math.Pow((double.Parse(PointBy) - double.Parse(PointCy)), 2);
double LenAC = Math.Pow((double.Parse(PointAx) - double.Parse(PointCx)), 2) + Math.Pow((double.Parse(PointAy) - double.Parse(PointCy)), 2);
//A为原点
double SplitAB = Math.Sqrt(LenAB) / (LineCount - 1);
double SplitAC = Math.Sqrt(LenAC) / (RowCount - 1);
int DirX = (double.Parse(PointAx) >= double.Parse(PointBx)) ? 0 : 1;
int DirY = (double.Parse(PointAy) >= double.Parse(PointCy)) ? 0 : 1;
///确认旋转方向,逆时针 0,顺时针 1
int DirA = (double.Parse(PointAy) >= double.Parse(PointBy)) ? 0 : 1;
///与x夹角
double SinAY = Math.Abs((double.Parse(PointAy) - double.Parse(PointBy)) / Math.Sqrt(LenAB));
double CosAY = Math.Abs((double.Parse(PointAx) - double.Parse(PointBx)) / Math.Sqrt(LenAB));
///与y夹角
double SinAX = Math.Abs((double.Parse(PointAx) - double.Parse(PointCx)) / Math.Sqrt(LenAC));
double CosAX = Math.Abs((double.Parse(PointAy) - double.Parse(PointCy)) / Math.Sqrt(LenAC));
for (int i = 0; i < LineCount * RowCount; i++)
{
string strPoint = FromIndexToPoint((i + 1), SplitAB, SplitAC, double.Parse(PointAx), double.Parse(PointAy), RowCount, LineCount, DirX, DirY, SinAY,CosAY, DirA, SinAX,CosAX);
strPoint = strPoint + "," + PointAz + "," + PointAu;
LStrPointLocatiton_OK.Add(string.Format("{0},{1},{2}", GlobalVar.OKPointFlag, kvp.Key, (i + 1)), strPoint);//左边OK盘坐标
//RStrPointLocatiton_OK.Add(string.Format("{0},{1},{2}", GlobalVar.OKPointFlag, kvp.Key, (i + 1)), strPoint);//左边OK盘坐标
}
}