Beispiel #1
0
        object ICloneable.Clone()
        {
            wPointF wp = new wPointF();

            wp.enable        = this.enable;
            wp.templateIndex = this.templateIndex;
            wp.X             = this.X;
            wp.Y             = this.Y;
            wp.T             = this.T;
            return(wp);
        }
Beispiel #2
0
        object ICloneable.Clone()
        {
            wPointF wP = new wPointF();

            wP.enable        = this.enable;
            wP.templateIndex = this.templateIndex;
            wP.X             = this.X;
            wP.Y             = this.Y;
            wP.T             = this.T;
            return(wP);
        }
Beispiel #3
0
        /// <summary>
        /// 三点阵列
        /// </summary>
        /// <param name="p1">点一</param>
        /// <param name="p2">点二</param>
        /// <param name="p3">点三</param>
        /// <param name="row">行</param>
        /// <param name="column">列</param>
        /// <param name="direction">阵列方向,行优先或者列优先</param>
        public static List <wPointF> MatrixArrayList(PointF3 p1, PointF3 p2, PointF3 p3, int row, int column, int direction)
        {
            float deltaX1, deltaY1, deltaZ1, deltaX2, deltaY2, deltaZ2;

            if (row <= 0 || column <= 0 || (row == 1 && column == 1))
            {
                return(null);
            }
            if (column > 1)
            {
                deltaX1 = (p1.X - p2.X) / (column - 1);
                deltaY1 = (p1.Y - p2.Y) / (column - 1);
                deltaZ1 = (p1.Z - p2.Z) / (column - 1);
            }
            else
            {
                deltaX1 = p1.X - p2.X;
                deltaY1 = p1.Y - p2.Y;
                deltaZ1 = p1.Z - p2.Z;
            }

            if (row > 1)
            {
                deltaX2 = (p3.X - p2.X) / (row - 1);
                deltaY2 = (p3.Y - p2.Y) / (row - 1);
                deltaZ2 = (p3.Z - p2.Z) / (row - 1);
            }
            else
            {
                deltaX2 = p3.X - p2.X;
                deltaY2 = p3.Y - p2.Y;
                deltaZ2 = p3.Z - p2.Z;
            }

            #region 做点

            List <wPointF> termlist = new List <wPointF>();

            if (direction == 0)                      //横向优先
            {
                for (int i = 0; i < row; i++)        //行
                {
                    for (int j = 0; j < column; j++) //列
                    {
                        wPointF stickPoint = new wPointF();
                        if (i % 2 == 0)
                        {
                            stickPoint.X = p2.X + deltaX1 * j + deltaX2 * i;
                            stickPoint.Y = p2.Y + deltaY1 * j + deltaY2 * i;
                            //stickPoint.Z = p2.Z + deltaZ1 * j + deltaZ2 * i;
                        }
                        else
                        {
                            stickPoint.X = p2.X + deltaX1 * (column - 1 - j) + deltaX2 * i;
                            stickPoint.Y = p2.Y + deltaY1 * (column - 1 - j) + deltaY2 * i;
                            //stickPoint.Z = p2.Z + deltaZ1 * (column - 1 - j) + deltaZ2 * i;
                        }
                        termlist.Add(stickPoint);
                    }
                }
            }
            else if (direction == 1)              //纵向优先
            {
                for (int i = 0; i < column; i++)  //列
                {
                    for (int j = 0; j < row; j++) //行
                    {
                        wPointF stickPoint = new wPointF();
                        if (i % 2 == 0)
                        {
                            stickPoint.X = p2.X + deltaX2 * j + deltaX1 * i;
                            stickPoint.Y = p2.Y + deltaY2 * j + deltaY1 * i;
                            //stickPoint.Z = p2.Z + deltaZ2 * j + deltaZ1 * i;
                        }
                        else
                        {
                            stickPoint.X = p2.X + deltaX2 * (row - 1 - j) + deltaX1 * i;
                            stickPoint.Y = p2.Y + deltaY2 * (row - 1 - j) + deltaY1 * i;
                            //stickPoint.Z = p2.Z + deltaZ2 * (row - 1 - j) + deltaZ1 * i;
                        }
                        termlist.Add(stickPoint);
                    }
                }
            }
            #endregion
            return(termlist);
        }