public static PointF3 Rotate(int Nuzzle, PointF3 BeforePoint, float Angle) { var para = Database.Product.Inst.Stickdata.StickSysData; PointF3 point = new PointF3(); PointF3 AfterPoint = new PointF3(); double angleHude = Angle * Math.PI / 180;/*角度变成弧度*/ if (Nuzzle == 0) { double x1 = (para.Lift000CCDPos.X - para.Liftcirclepoint.X) * Math.Cos(angleHude) + (para.Lift000CCDPos.Y - para.Liftcirclepoint.Y) * Math.Sin(angleHude) + para.Liftcirclepoint.X; double y1 = -(para.Lift000CCDPos.X - para.Liftcirclepoint.X) * Math.Sin(angleHude) + (para.Lift000CCDPos.Y - para.Liftcirclepoint.Y) * Math.Cos(angleHude) + para.Liftcirclepoint.Y; AfterPoint.X = (float)x1; AfterPoint.Y = (float)y1; point.X = AfterPoint.X - (BeforePoint.X - para.Lift000CCDPos.X); point.Y = AfterPoint.Y - (BeforePoint.Y - para.Lift000CCDPos.Y); } else { double x1 = (para.Right000CCDPos.X - para.Rightcirclepoint.X) * Math.Cos(angleHude) + (para.Right000CCDPos.Y - para.Rightcirclepoint.Y) * Math.Sin(angleHude) + para.Rightcirclepoint.X; double y1 = -(para.Right000CCDPos.X - para.Rightcirclepoint.X) * Math.Sin(angleHude) + (para.Right000CCDPos.Y - para.Rightcirclepoint.Y) * Math.Cos(angleHude) + para.Rightcirclepoint.Y; AfterPoint.X = (float)x1; AfterPoint.Y = (float)y1; point.X = AfterPoint.X - (BeforePoint.X - para.Lift000CCDPos.X); point.Y = AfterPoint.Y - (BeforePoint.Y - para.Lift000CCDPos.Y); } return(point); }
public StickSysDataDef() { LiftCCDPos = new PointF3(); LiftNuzzlePos = new PointF3(); RightCCDPos = new PointF3(); RightNuzzlePos = new PointF3(); LiftNuzzleRotaCenter = new PointF2(); RightNuzzleRotaCenter = new PointF2(); Liftcirclepoint = new PointF3(); Rightcirclepoint = new PointF3(); LiftDownCCDPos = new PointF3(); RightDownCCDPos = new PointF3(); Lift000CCDPos = new PointF3(); Lift180CCDPos = new PointF3(); Right000CCDPos = new PointF3(); Right180CCDPos = new PointF3(); }
public void MatrixArrayProduct(PointF3 p1, PointF3 p2, PointF3 p3, int row, int column, int DripDirection, ProductDef products) { float deltaX1, deltaY1, deltaX2, deltaY2; //p2 中间点 if (row <= 0 || column <= 0 || (row == 1 && column == 1)) { return; } if (row > 1) { deltaX1 = (p1.X - p2.X) / (row - 1); deltaY1 = (p1.Y - p2.Y) / (row - 1); } else { deltaX1 = p1.X - p2.X; deltaY1 = p1.Y - p2.Y; } if (column > 1) { deltaX2 = (p3.X - p2.X) / (column - 1); deltaY2 = (p3.Y - p2.Y) / (column - 1); } else { deltaX2 = p3.X - p2.X; deltaY2 = p3.Y - p2.Y; } tempProduct.Clear(); #region 无隔离 if (DripDirection == 0) //横向优先 { for (int i = 0; i < row; i++) //行 { for (int j = 0; j < column; j++) //列 { ProductDef p = new ProductDef(); p = products.Clone(); for (int k = 0; k < p.SiteList.Count; k++) { p.SiteList[k].X += (i * deltaX1 + j * deltaX2); p.SiteList[k].Y += (i * deltaY1 + j * deltaY2); p.SiteList[k].Product_num = i + j; } p.MarkPoint[0].X += (i * deltaX1 + j * deltaX2); p.MarkPoint[0].Y += (i * deltaY1 + j * deltaY2); p.MarkPoint[1].X += (i * deltaX1 + j * deltaX2); p.MarkPoint[1].Y += (i * deltaY1 + j * deltaY2); p.CodePoint2.X += (i * deltaX1 + j * deltaX2); p.CodePoint2.Y += (i * deltaY1 + j * deltaY2); p.BackCT.X += (i * deltaX1 + j * deltaX2); p.BackCT.Y += (i * deltaY1 + j * deltaY2); tempProduct.Add(p); } } } else if (DripDirection == 1) //纵向优先 { for (int i = 0; i < column; i++) //列 { for (int j = 0; j < row; j++) //行 { ProductDef p = new ProductDef(); p = products.Clone(); for (int k = 0; k < p.SiteList.Count; k++) { p.SiteList[k].X += (i * deltaX1 + j * deltaX2); p.SiteList[k].Y += (i * deltaY1 + j * deltaY2); p.SiteList[k].Product_num = i + j; } p.MarkPoint[0].X += (i * deltaX1 + j * deltaX2); p.MarkPoint[0].Y += (i * deltaY1 + j * deltaY2); p.MarkPoint[1].X += (i * deltaX1 + j * deltaX2); p.MarkPoint[1].Y += (i * deltaY1 + j * deltaY2); p.CodePoint2.X += (i * deltaX1 + j * deltaX2); p.CodePoint2.Y += (i * deltaY1 + j * deltaY2); p.BackCT.X += (i * deltaX1 + j * deltaX2); p.BackCT.Y += (i * deltaY1 + j * deltaY2); tempProduct.Add(p); } } } #endregion }
public void MatrixArrayList(PointF3 p1, PointF3 p2, PointF3 p3, int row, int column, int DripDirection) { float deltaX1, deltaY1, deltaX2, deltaY2; if (row <= 0 || column <= 0 || (row == 1 && column == 1)) { return; } if (row > 1) { deltaX1 = (p1.X - p2.X) / (row - 1); deltaY1 = (p1.Y - p2.Y) / (row - 1); } else { deltaX1 = p1.X - p2.X; deltaY1 = p1.Y - p2.Y; } if (column > 1) { deltaX2 = (p3.X - p2.X) / (column - 1); deltaY2 = (p3.Y - p2.Y) / (column - 1); } else { deltaX2 = p3.X - p2.X; deltaY2 = p3.Y - p2.Y; } List <PointF> termlist = new List <PointF>(); #region 无隔离 if (DripDirection == 0) //横向优先 { for (int i = 0; i < row; i++) //行 { for (int j = 0; j < column; j++) //列 { PointF stickPoint = new PointF(); if (i % 2 == 0) { stickPoint.X = p2.X + deltaX1 * j + deltaX2 * i; stickPoint.Y = p2.Y + deltaY1 * j + deltaY2 * i; } else { stickPoint.X = p2.X + deltaX1 * (column - 1 - j) + deltaX2 * i; stickPoint.Y = p2.Y + deltaY1 * (column - 1 - j) + deltaY2 * i; } termlist.Add(stickPoint); } } } else if (DripDirection == 1) //纵向优先 { for (int i = 0; i < column; i++) //列 { for (int j = 0; j < row; j++) //行 { PointF stickPoint = new PointF(); if (i % 2 == 0) { stickPoint.X = p2.X + deltaX2 * j + deltaX1 * i; stickPoint.Y = p2.Y + deltaY2 * j + deltaY1 * i; } else { stickPoint.X = p2.X + deltaX2 * (row - 1 - j) + deltaX1 * i; stickPoint.Y = p2.Y + deltaY2 * (row - 1 - j) + deltaY1 * i; } termlist.Add(stickPoint); } } } #endregion tempPoint = new List <SitePoint>(); for (int i = 0; i < termlist.Count; i++) { SitePoint site = new SitePoint(); site.X = termlist[i].X; site.Y = termlist[i].Y; tempPoint.Add(site); } }