private ProductDef MarkCaculate(ProductDef product) { ProductDef pp = product.Clone(); pp.SiteList.Clear(); for (int i = 0; i < product.SiteList.Count; i++) { SitePoint site = new SitePoint(); site = product.SiteList[i].Clone(); HalconDotNet.HTuple x; HalconDotNet.HTuple y; VisionProject.Instance.Tool.PointLocation.AffineTransPoint2d( product.SiteList[i].X, product.SiteList[i].Y, out x, out y); site.X = x[0].F; site.Y = y[0].F; pp.SiteList.Add(site); } return(pp); }
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 }