当前位置: 首页>>代码示例>>C#>>正文


C# Point.CopyTo方法代码示例

本文整理汇总了C#中Point.CopyTo方法的典型用法代码示例。如果您正苦于以下问题:C# Point.CopyTo方法的具体用法?C# Point.CopyTo怎么用?C# Point.CopyTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Point的用法示例。


在下文中一共展示了Point.CopyTo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Triangle

 public Triangle(Point[] v)
 {
     vertex = new Point[3];
     v.CopyTo(vertex, 0);
 }
开发者ID:TravisCG,项目名称:Triangulator,代码行数:5,代码来源:Triangle.cs

示例2: InsertPoints

 public void InsertPoints(Point[] pts)
 {
     if (!sync.Blocked)
     {
         sync.Block();
         points = new Point[pts.Length];
         pts.CopyTo(points, 0);
         sync.Relese();
     }
 }
开发者ID:slawer,项目名称:service,代码行数:10,代码来源:GraphicCalibration.cs

示例3: MapPoints

 public static Point[] MapPoints(IntPtr hWndFrom, Point[] points, IntPtr hWndTo)
 {
     Point[] pts = new Point[points.Length];
     points.CopyTo(pts, 0);
     for (int i = 0; i < pts.Length; i++)
         MapWindowPoints(hWndFrom, hWndTo, ref pts[i], 1);
     return pts;
 }
开发者ID:tweeger,项目名称:DotNetSpy,代码行数:8,代码来源:NativeMethods.cs

示例4: LookInDirection


//.........这里部分代码省略.........
        //                 * BrrMrr.
        //                 *  .....
        //                 *   ...
        //                 *    X
        //                 *
        //                 * X — the initial point
        //                 * M — rangeMiddle
        //                 * B — beginning point of iteration
        //                 *
        //                 * (in this example, distance == 3 and direction == MoveDirection.Up)
        //                 *
        //                 */
        //                
        //                Point rangeMiddle = this.MoveInDirection (direction, distance);
        //                Point newPoint = rangeMiddle.MoveInDirection (direction.TurnCounterClockwise(), distance);
        //                
        //                result.Add (newPoint);
        //                MoveDirection aroundDirection = direction.TurnClockwise();
        //                
        //                for (int i=0; i<distance*2 - 1; i++) {
        //                    newPoint = newPoint.MoveInDirection (aroundDirection);
        //                    result.Add (newPoint);
        //                }
        //                
        //            }
        //            
        //            return result;
        //        }
        /*
         * Here's how the return looks:
         *
         *     8
         *    678
         *   45678
         *  2345678
         * x12345678
         *  .345678
         *   .5678
         *    .78
         *     .
         *
         * x — the initial point
         * i — the points in result[i]
         *
         * notice that the return isn't symmetrical — so that LookInDirection for 4 directions don't intersect
         *
         * recursiveResult is the result of the same function with distance-1
         * unless you want some optimizations, it's safe to leave it at null
         *
         */
        public Point[][] LookInDirection(MoveDirection direction, int distance, Point[][] recursiveResult = null)
        {
            Point[][] result = new Point [distance + 1][];

            if (direction == MoveDirection.Stay || distance == 0) {

                result [0] = new Point[1];
                result [0] [0] = new Point (x, y);

            } else {

                if (recursiveResult == null)
                    LookInDirection (direction, distance - 1).CopyTo (result, 0);
                else
                    recursiveResult.CopyTo (result, 0);

                Point[] pointsAtDistance = new Point[distance];
                Point[] pointsAtPreviousDistance = result [distance - 1];

                if (distance == 1) {

                    pointsAtDistance [0] = pointsAtPreviousDistance [0].MoveInDirection (direction);

                } else {

                    bool evenDistance = (distance % 2) == 0;
                    int d = 0;

                    if (evenDistance && distance > 1) {
                        pointsAtDistance [0] =
                        pointsAtPreviousDistance [0].MoveInDirection (direction.TurnCounterClockwise ());
                        d = 1;
                    }

                    for (int i=0; i<distance-1; i++)
                        pointsAtDistance [i + d] =
                        pointsAtPreviousDistance [i].MoveInDirection (direction);

                    if (!evenDistance && distance > 1)
                        pointsAtDistance [distance - 1] =
                        pointsAtPreviousDistance [distance - 2].MoveInDirection (direction.TurnClockwise ());

                }

                result [distance] = pointsAtDistance;

            }

            return result;
        }
开发者ID:golergka,项目名称:genetic-ants,代码行数:101,代码来源:Point.cs


注:本文中的Point.CopyTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。