當前位置: 首頁>>代碼示例>>C#>>正文


C# System.Point類代碼示例

本文整理匯總了C#中System.Point的典型用法代碼示例。如果您正苦於以下問題:C# Point類的具體用法?C# Point怎麽用?C# Point使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Point類屬於System命名空間,在下文中一共展示了Point類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的System.Point類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。