• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# System.Point类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Point类属于System命名空间,在下文中一共展示了Point类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AddMap

 public void AddMap(RobotMap map, Point offset)
 {
     foreach (var item in map.Map)
     {
         Map.Add(item.Key + offset, item.Value);
     }
 }
开发者ID:exyi,项目名称:LtpRobot,代码行数:7,代码来源:RobotMap.cs


示例2: GetFeature

            /// <summary>
            /// Blocking unary call example.  Calls GetFeature and prints the response.
            /// </summary>
            public void GetFeature(int lat, int lon)
            {
                try
                {
                    Log("*** GetFeature: lat={0} lon={1}", lat, lon);

                    Point request = new Point { Latitude = lat, Longitude = lon };
                    
                    Feature feature = client.GetFeature(request);
                    if (feature.Exists())
                    {
                        Log("Found feature called \"{0}\" at {1}, {2}",
                            feature.Name, feature.Location.GetLatitude(), feature.Location.GetLongitude());
                    }
                    else
                    {
                        Log("Found no feature at {0}, {1}",
                            feature.Location.GetLatitude(), feature.Location.GetLongitude());
                    }
                }
                catch (RpcException e)
                {
                    Log("RPC failed " + e);
                    throw;
                }
            }
开发者ID:rwightman,项目名称:grpc,代码行数:29,代码来源:Program.cs


示例3: GetInsidePoint

 public static Point GetInsidePoint(IReadOnlyList<Point> points, Box boundingBox)
 {
     var y = (boundingBox.MinY + boundingBox.MaxY) / 2;
     var xIntersections = new List<double>();
     var point1 = points.Last();
     foreach (var point2 in points)
     {
         if ((y > point1.Y) != (y > point2.Y))
         {
             xIntersections.Add((y - point2.Y) * (point1.X - point2.X) / (point1.Y - point2.Y) + point2.X);
         }
         point1 = point2;
     }
     xIntersections.Sort();
     Debugger.BreakWhen(xIntersections.Count == 0 || xIntersections.Count % 2 != 0);
     var x = (boundingBox.MinX + boundingBox.MaxX) / 2;
     var maxDelta = double.NegativeInfinity;
     for (var i = 0; i < xIntersections.Count - 1; i += 2)
     {
         var delta = Math.Abs(xIntersections[i] - xIntersections[i + 1]);
         if (delta > maxDelta)
         {
             x = (xIntersections[i] + xIntersections[i + 1]) / 2;
             maxDelta = delta;
         }
     }
     var point = new Point(x, y);
     #if DEBUG
     Debugger.BreakWhen(!PointInPolygonTest.Contains(points, point));
     #endif
     return point;
 }
开发者ID:rflechner,项目名称:SvgToVectorDrawableConverter,代码行数:32,代码来源:PointInsidePolygonCalculator.cs


示例4: RectangleImpl

 public RectangleImpl(Point lowerLeft, Point upperRight)
 {
     this.minX = lowerLeft.GetX();
     this.maxX = upperRight.GetX();
     this.minY = lowerLeft.GetY();
     this.maxY = upperRight.GetY();
 }
开发者ID:ccurrens,项目名称:Spatial4n,代码行数:7,代码来源:RectangleImpl.cs


示例5: TimKiemNuocDi

        // p1: đối thủ
        // p2: 
        private Point TimKiemNuocDi(int p1, int p2)
        {
            Point oCoResult = new Point();
            long DiemMax = 0;
            for (int i = 0; i < cell_quantity; i++)
            {
                for (int j = 0; j < cell_quantity; j++)
                {
                    if (matrix[i, j] == 0)
                    {
                        long DiemTanCong = DiemTanCong_DuyetDoc(i, j, p1, p2) + DiemTanCong_DuyetNgang(i, j, p1, p2) + DiemTanCong_DuyetCheoNguoc(i, j, p1, p2) + DiemTanCong_DuyetCheoXuoi(i, j, p1, p2);
                        long DiemPhongNgu = DiemPhongNgu_DuyetDoc(i, j, p1, p2) + DiemPhongNgu_DuyetNgang(i, j, p1, p2) + DiemPhongNgu_DuyetCheoNguoc(i, j, p1, p2) + DiemPhongNgu_DuyetCheoXuoi(i, j, p1, p2);
                        long DiemTam = DiemTanCong > DiemPhongNgu ? DiemTanCong : DiemPhongNgu;
                        if (DiemMax < DiemTam)
                        {
                            DiemMax = DiemTam;
                            oCoResult = new Point(i, j);

                        }
                    }
                }
            }

            return oCoResult;
        }
开发者ID:haandang,项目名称:1312179_Gomoku,代码行数:27,代码来源:TimKiemNuocDi.cs


示例6: TestDistance

 public void TestDistance()
 {
     Point p1 = new Point(-2, -3);
     Point p2 = new Point(-4, 4);
     double distance = Trigonometry.Distance(p1, p2);
     Assert.AreEqual(7.28, distance, 0.01);
 }
开发者ID:ZoolWay,项目名称:Geometry,代码行数:7,代码来源:TrigonometryTest.cs


示例7: Func1

 public void Func1()
 {
     Point a = new Point(10, 10);
     Point b = a;
     a.x = 100;
     System.Console.WriteLine(b.x);
 }
开发者ID:Puppetplay,项目名称:Effective,代码行数:7,代码来源:_1_Structure.cs


示例8: Filter

        public IList<Point> Filter(IList<Point> points)
        {
            IList<Point> result = new List<Point>();
            if (points.Count == 0)
            {
                return result;
            }

            var point = new Point(points.First());
            result.Add(point);

            foreach (var currentSourcePoint in points.Skip(1))
            {
                if (!this.DistanceIsTooSmall(currentSourcePoint, point))
                {
                    point = new Point(currentSourcePoint);
                    result.Add(point);
                }
            }

            if (this.checkBoundary && result.Count > 1)
            {
                CheckFirstAndLastPoint(result);
            }

            return result;
        }
开发者ID:an83,项目名称:KinectTouch2,代码行数:27,代码来源:LineThinner.cs


示例9: PrintGrid

        public static string PrintGrid(int[,] grid, IEnumerable<Point> path = null, IEnumerable<Point> pawns = null)
        {
            string str = string.Empty;
            HashSet<Point> pathPoints = new HashSet<Point>(path);

            for (int j = 0; j < grid.GetLength(0); j++) {
                for (int i = 0; i < grid.GetLength(1); i++) {
                    Point point = new Point(i, j);
                    if (pawns != null && pawns.Contains(point)) {
                        str += "╬";
                    } else if (path != null && pathPoints.Contains(point)) {
                        str += "┼";
                    } else {
                        switch (grid[j, i]) {
                            case Board.WALL_TILE:
                                str += "█";
                                break;
                            case Board.FLOOR_TILE:
                                str += "░";
                                break;
                        }
                    }
                }
                str += "\n";
            }

            return str;
        }
开发者ID:RolandMQuiros,项目名称:Lost-Generation,代码行数:28,代码来源:BoardCommon.cs


示例10: Vertex

 public Vertex(Point p)
 {
     Self = p;
     Num = Low = 0;
     Visited = false;
     Parent = null;
 }
开发者ID:analyst74,项目名称:aichallenge-tron,代码行数:7,代码来源:Vertex.cs


示例11: Pathfinding

 public Pathfinding(Map ma, Point m, Point t, int r)
 {
     map = ma;
     me = m;
     target = t;
     range = r;
 }
开发者ID:bytecode0101,项目名称:uWarcraft,代码行数:7,代码来源:Pathfinding.cs


示例12: ToPixelSpace

 public Point ToPixelSpace(Point quadraticPos)
 {
     var pixelPos = new Point(
         quadraticToPixelScale.Width * quadraticPos.X + quadraticToPixelOffset.X,
         quadraticToPixelScale.Height * quadraticPos.Y + quadraticToPixelOffset.Y);
     return new Point((float)Math.Round(pixelPos.X, 2), (float)Math.Round(pixelPos.Y, 2));
 }
开发者ID:lilinghui,项目名称:DeltaEngine,代码行数:7,代码来源:ScreenSpace.cs


示例13: SubmitForm

 public override void SubmitForm(Form form)
 {
     base.SubmitForm(form);
     BlockWidth = (int)form.Datas["BlockWidth"];
     BlockHeight = (int)form.Datas["BlockHeight"];
     BlockCenter = (Point)form.Datas["BlockCenter"];
 }
开发者ID:BlaisePascalSi,项目名称:PokeSi,代码行数:7,代码来源:MultiTileTile.cs


示例14: PrintMap

 public string[] PrintMap(int xMin, int yMin, int width, int heigth, Point robotPosition)
 {
     var robotX = robotPosition.X - xMin;
     var robotY = robotPosition.Y - yMin;
     var result = new string[heigth];
     for (int y = 0; y < heigth; y++)
     {
         var ch = new char[width];
         for (int x = 0; x < width; x++)
         {
             var p = new Point(xMin + x, yMin + y);
             if(robotX == x && robotY == y)
             {
                 ch[x] = '&';
             }
             else if (Map.ContainsKey(p))
             {
                 ch[x] = (char)Map[p];
             }
             else ch[x] = ' ';
         }
         result[y] = new string(ch);
     }
     Array.Reverse(result);
     return result;
 }
开发者ID:exyi,项目名称:LtpRobot,代码行数:26,代码来源:RobotMap.cs


示例15: GetPointAtFractionLength

        public Point GetPointAtFractionLength(double t, out Point tangent)
        {
            // Calculate point on curve.
            double x = (1 - t) * (1 - t) * (1 - t) * Point0.X +
                       3 * t * (1 - t) * (1 - t) * Point1.X +
                       3 * t * t * (1 - t) * Point2.X +
                       t * t * t * Point3.X;

            double y = (1 - t) * (1 - t) * (1 - t) * Point0.Y +
                       3 * t * (1 - t) * (1 - t) * Point1.Y +
                       3 * t * t * (1 - t) * Point2.Y +
                       t * t * t * Point3.Y;

            Point point = new Point(x, y);

            // Calculate tangent to curve.
            x = 3 * (1 - t) * (1 - t) * (Point1.X - Point0.X) +
                6 * t * (1 - t) * (Point2.X - Point1.X) +
                3 * t * t * (Point3.X - Point2.X);

            y = 3 * (1 - t) * (1 - t) * (Point1.Y - Point0.Y) +
                6 * t * (1 - t) * (Point2.Y - Point1.Y) +
                3 * t * t * (Point3.Y - Point2.Y);

            tangent = new Point(x, y);
            return point;
        }
开发者ID:jenart,项目名称:xamarin-forms-book-preview-2,代码行数:27,代码来源:BezierSpline.cs


示例16: GetDestination

        public Point GetDestination(Point destination, FixedObject destObject, Hero hero)
        {
            var cell = Map.PointToCell(destination);
            var obj = Game.Map.GetObjectFromCell(cell);

            var largeObjectOuter = obj as LargeObjectOuterAbstract;

            if(largeObjectOuter == null)
                return destination;

            var startingPoint = new Point(cell.X - largeObjectOuter.PlaceInObject.X, cell.Y - largeObjectOuter.PlaceInObject.Y);

            var innerObject = largeObjectOuter.InnerObject as Wickiup;
            var totDist = Int32.MaxValue;
            Point p = null;
            var heroPos = Map.PointToCell(hero.Position);

            for (int i = 0; i < (int)innerObject.Size.Width + 2; i++ )
            {
                for (int j = 0; j < (int) innerObject.Size.Height + 2; j++)
                {
                    if (i > 0 && i < (int) innerObject.Size.Width + 1 && j > 0 && j < (int) innerObject.Size.Height + 1)
                        continue;

                    var curPoint = new Point(i - 1, j - 1);
                    bool isPassable;

                    if (j == 0 || j == (int) innerObject.Size.Height + 1)
                    {
                        isPassable = innerObject.HorizontalBorder[i, j == 0 ? 0 : 1];
                    }
                    else
                    {
                        isPassable = innerObject.VerticalBorder[j - 1, i == 0 ? 0 : 1];
                    }

                    if (!isPassable)
                        continue;

                    int totdistX = Math.Abs(heroPos.X - startingPoint.X - curPoint.X);
                    int totdistY = Math.Abs(heroPos.Y - startingPoint.Y - curPoint.Y);

                    var curtotDist = totdistX*totdistX + totdistY*totdistY;

                    if (curtotDist < totDist)
                    {
                        totDist = curtotDist;
                        p = curPoint;
                    }
                }
            }

            var newCenterPoint = Map.CellToPoint(new Point(startingPoint.X + p.X, startingPoint.Y + p.Y));
            var x = newCenterPoint.X + Map.CELL_MEASURE / 2 + (p.X > -1 && p.X < innerObject.Size.Width ? 0 :  p.X == -1 ? Map.CELL_MEASURE / 2 + 2 : -Map.CELL_MEASURE / 2 - 2);
            var y = newCenterPoint.Y + Map.CELL_MEASURE / 2 + (p.Y > -1 && p.Y < innerObject.Size.Height ? 0 : p.Y == -1 ? Map.CELL_MEASURE / 2 + 2 : -Map.CELL_MEASURE / 2 - 2);

            innerPoint = startingPoint;

            return new Point(x, y);
        }
开发者ID:norniel,项目名称:Game,代码行数:60,代码来源:EnterAction.cs


示例17: ScSign

 public ScSign(string text, TSPlayer registrar, Point point)
 {
     _point = point;
     cooldown = 0;
     _cooldownGroup = string.Empty;
     RegisterCommands(text, registrar);
 }
开发者ID:Denwey,项目名称:SignCommands,代码行数:7,代码来源:scSign.cs


示例18: Solve_Part2

        internal static void Solve_Part2()
        {
            Console.WriteLine("Solving Day 01, Part 2...");

              var directions = System.IO.File.ReadAllText("01.txt").Split(',');
              var pt = new Point();
              var hist = new List<string>();

              foreach (var direction in directions)
              {
            if (string.IsNullOrWhiteSpace(direction))
              continue;

            var beenThere = pt.Walk(
              direction.Trim().Substring(0, 1),
              int.Parse(direction.Trim().Substring(1)),
              true);
            if (beenThere)
              break;
              }

              // wrong:
              //   297 (high)
              // correct:
              //   163

              return;
        }
开发者ID:gkaiser,项目名称:challenges,代码行数:28,代码来源:Day01.cs


示例19: VoronoiRegion

 public VoronoiRegion(Vertex generator)
 {
     this.id = generator.id;
     this.generator = generator;
     this.vertices = new List<Point>();
     this.bounded = true;
 }
开发者ID:JackTing,项目名称:PathCAM,代码行数:7,代码来源:VoronoiRegion.cs


示例20: Solve_Part1

        internal static void Solve_Part1()
        {
            Console.WriteLine("Solving Day 01, Part 1...");

              var directions = System.IO.File.ReadAllText("01.txt").Split(',');
              var pt = new Point();

              foreach (var direction in directions)
              {
            if (string.IsNullOrWhiteSpace(direction))
              continue;

            pt.Walk(
              direction.Trim().Substring(0, 1),
              int.Parse(direction.Trim().Substring(1)),
              false);
              }

              Console.WriteLine($"You are at {pt}; which is {Math.Abs(pt.X) + Math.Abs(pt.Y)} blocks away...");

              // correct:
              //   279

              return;
        }
开发者ID:gkaiser,项目名称:challenges,代码行数:25,代码来源:Day01.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# System.ProcessResult类代码示例发布时间:2022-05-26
下一篇:
C# System.Platform类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap