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


C# Point.Contains方法代码示例

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


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

示例1: Test_ToString

        public void Test_ToString()
        {
            var pointString = new Point(1, 2, 3).ToString();

            Assert.IsTrue(pointString.Contains("1"));
            Assert.IsTrue(pointString.Contains("2"));
            Assert.IsTrue(pointString.Contains("3"));
        }
开发者ID:aabrohi,项目名称:kinect-kollage,代码行数:8,代码来源:PointTests.cs

示例2: GetRoadTime

        public long GetRoadTime(Point[] points)
        {
            DBC.Assert(points.Length == 2, "Can only get the distance between 2 points.");

            if (points.Contains(PointMother.ChannelSt) && points.Contains(PointMother.EthelSt))
                return 840;

            if (points.Contains(PointMother.EthelSt) && points.Contains(PointMother.BurchellSt))
                return 1800;

            if (points.Contains(PointMother.ChannelSt) && points.Contains(PointMother.BurchellSt))
                return 2280;

            throw new Exception("Unknown points");
        }
开发者ID:liammclennan,项目名称:shortest-path,代码行数:15,代码来源:ChannelEthelBurchellRoadService.cs

示例3: GetRoadTime

        public long GetRoadTime(Point[] points)
        {
            DBC.Assert(points.Length == 2, "Can only get the distance between 2 points.");

            if (points.Contains(PointMother.ChannelSt) && points.Contains(PointMother.DelanceySt))
                return 480;

            if (points.Contains(PointMother.ChannelSt) && points.Contains(PointMother.BeckwithSt))
                return 660;

            if (points.Contains(PointMother.ChannelSt) && points.Contains(PointMother.ThornlandsRd))
                return 600;

            if (points.Contains(PointMother.BeckwithSt) && points.Contains(PointMother.DelanceySt))
                return 300;

            if (points.Contains(PointMother.BeckwithSt) && points.Contains(PointMother.ThornlandsRd))
                return 1020;

            if (points.Contains(PointMother.DelanceySt) && points.Contains(PointMother.ThornlandsRd))
                return 820;

            throw new Exception("Unknown points");
        }
开发者ID:liammclennan,项目名称:shortest-path,代码行数:24,代码来源:ChannelDelanceyBeckwithThornlandsRoadService.cs

示例4: FindPath

 //static public List<Point> FindPlaceRadius(Point point, int movementPoints)
 //{
 //    return FindMovementRadius(new Point[] { point }, movementPoints, FieldToPlaceMap());
 //}
 //static public List<Point> FindPlaceRadius(Point[] points, int movementPoints)
 //{
 //    return FindMovementRadius(points, movementPoints, FieldToPlaceMap());
 //}
 public static List<Point> FindPath(Point[] from, Point to, int[,] map)
 {
     List<Point> path = new List<Point>();
     path.Add(to);
     foreach (Point p in from)
         if (Math.Abs(p.Y - to.Y) + Math.Abs(p.X - to.X) == 1)
         {
             return path;
         }
     while (!from.Contains(to))
     {
         if (to.Y - 1 >= 0 && map[to.Y - 1, to.X] == map[to.Y, to.X] - 1)
         {
             to = new Point(to.X, to.Y - 1);
             path.Add(to);
         }
         else if (to.X + 1 < GameLogic.Field.Width && map[to.Y, to.X + 1] == map[to.Y, to.X] - 1)
         {
             to = new Point(to.X + 1, to.Y);
             path.Add(to);
         }
         else if (to.Y + 1 < GameLogic.Field.Height && map[to.Y + 1, to.X] == map[to.Y, to.X] - 1)
         {
             to = new Point(to.X, to.Y + 1);
             path.Add(to);
         }
         else if (to.X - 1 >= 0 && map[to.Y, to.X - 1] == map[to.Y, to.X] - 1)
         {
             to = new Point(to.X - 1, to.Y);
             path.Add(to);
         }
         else break;
     }
     return path;
 }
开发者ID:alexeychikk,项目名称:BattleFigures,代码行数:43,代码来源:Path.cs

示例5: IsContinuous

        //檢查一群組所有的格網點是否連續(上下左右視為連續,對角與間隔視為不連續))
        public static bool IsContinuous(List<Point> pl)
        {
            if(pl.Count == 0)
            {
                return false;
            }

            Point[] workQueue = new Point[pl.Count];
            workQueue[0] = pl[0];
            for (int i = 1; i < workQueue.Length; ++i)
            {
                workQueue[i].X = -1;
                workQueue[i].Y = -1;
            }
            int ptr = 1;
            for (int i = 0; i < workQueue.Length; ++i)
            {
                Point p0 = workQueue[i];
                if (-1 == p0.X)
                {
                    break;
                }

                Point p1 = new Point(p0.X, p0.Y - 1);
                Point p2 = new Point(p0.X, p0.Y + 1);
                Point p3 = new Point(p0.X - 1, p0.Y);
                Point p4 = new Point(p0.X + 1, p0.Y);

                foreach (Point p in pl)
                {
                    if (p1 == p)
                    {
                        if (!workQueue.Contains(p1))
                        {
                            workQueue[ptr++] = p1;
                        }
                    }
                    if (p2 == p)
                    {
                        if (!workQueue.Contains(p2))
                        {
                            workQueue[ptr++] = p2;
                        }
                    }
                    if (p3 == p)
                    {
                        if (!workQueue.Contains(p3))
                        {
                            workQueue[ptr++] = p3;
                        }
                    }
                    if (p4 == p)
                    {
                        if (!workQueue.Contains(p4))
                        {
                            workQueue[ptr++] = p4;
                        }
                    }
                }
            }
            return (ptr == pl.Count);
        }
开发者ID:alcor0,项目名称:ResedUI,代码行数:63,代码来源:Utility.cs

示例6: CountNumberOfOpenNeighbors

        public int CountNumberOfOpenNeighbors(Point[] cells)
        {
            var open = 0;

            foreach (var cell in cells)
            {
                foreach (var neighbor in GetNeighboringPoints(cell))
                {
                    if (neighbor.X >= 0 && neighbor.X < BoardState.Width && neighbor.Y >= 0 &&
                        neighbor.Y < BoardState.Height &&
                        !BoardState.Cells[neighbor.X, neighbor.Y] && !cells.Contains(neighbor))
                        open++;
                }
            }

            return open;
        }
开发者ID:tstivers,项目名称:icfp2015,代码行数:17,代码来源:GameState.cs

示例7: CheckRemovedLines

        public int CheckRemovedLines(Point[] cells, int minHeight, int maxHeight)
        {
            var removedLines = 0;
            for (var i = minHeight; i <= maxHeight; i++)
            {
                var removed = true;
                for (var j = 0; j < BoardState.Width; j++)
                {
                    if (!BoardState.Cells[j, i] && !cells.Contains(new Point(j, i)))
                    {
                        removed = false;
                        break;
                    }
                }

                if (removed)
                    removedLines++;
            }

            return removedLines;
        }
开发者ID:tstivers,项目名称:icfp2015,代码行数:21,代码来源:GameState.cs

示例8: GetRoadTime

        public long GetRoadTime(Point[] points)
        {
            DBC.Assert(points.Length == 2, "Can only get the distance between 2 points.");

            if (points.Contains(PointMother.USAPoints.LocustSt) && points.Contains(PointMother.USAPoints.AshworthRd))
                return 660;

            if (points.Contains(PointMother.USAPoints.LocustSt) && points.Contains(PointMother.USAPoints.UniversityAve))
                return 180;

            if (points.Contains(PointMother.USAPoints.LocustSt) && points.Contains(PointMother.USAPoints.RaccoonSt))
                return 480;

            if (points.Contains(PointMother.USAPoints.LocustSt) && points.Contains(PointMother.USAPoints.ShawSt))
                return 360;

            if (points.Contains(PointMother.USAPoints.AshworthRd) && points.Contains(PointMother.USAPoints.UniversityAve))
                return 600;

            if (points.Contains(PointMother.USAPoints.AshworthRd) && points.Contains(PointMother.USAPoints.RaccoonSt))
                return 840;

            if (points.Contains(PointMother.USAPoints.AshworthRd) && points.Contains(PointMother.USAPoints.ShawSt))
                return 780;

            if (points.Contains(PointMother.USAPoints.UniversityAve) && points.Contains(PointMother.USAPoints.RaccoonSt))
                return 480;

            if (points.Contains(PointMother.USAPoints.UniversityAve) && points.Contains(PointMother.USAPoints.ShawSt))
                return 420;

            if (points.Contains(PointMother.USAPoints.RaccoonSt) && points.Contains(PointMother.USAPoints.ShawSt))
                return 120;

            throw new Exception("Unknown points");
        }
开发者ID:liammclennan,项目名称:shortest-path,代码行数:36,代码来源:DesMoinesRoadService.cs

示例9: CheckAround

        private Point CheckAround(Point toCheck, Point[] lastPoints)
        {
            //Check in a square around the last point for new pixels
            for (int i = 0; i <= 7; i++)
            {
                //Get which point to check next
                Point delta = Delta(i);
                Point check = new Point(toCheck.X + delta.X, toCheck.Y + delta.Y);

                //Check if the vinyl contains the point
                if (!VinylContains(check))
                    continue;

                //Check if the point should not be ignored and isn't in the last points
                if (!IgnoreColor(GetColor(check)) && !lastPoints.Contains(check))
                    return check;
            }

            return Point.Empty;
        }
开发者ID:LucaScorpion,项目名称:Vixyl,代码行数:20,代码来源:VinylReader.cs


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