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


C# ICoordinate.Equals2D方法代码示例

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


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

示例1: Compare

        /// <summary>
        ///  Compares two <see cref="Coordinate" />s for their relative position along a segment
        /// lying in the specified <see cref="Octant" />.
        /// </summary>
        /// <param name="octant"></param>
        /// <param name="p0"></param>
        /// <param name="p1"></param>
        /// <returns>
        /// -1 if node0 occurs first, or
        ///  0 if the two nodes are equal, or
        ///  1 if node1 occurs first.
        /// </returns>
        public static int Compare(Octants octant, ICoordinate p0, ICoordinate p1)
        {
            // nodes can only be equal if their coordinates are equal
            if (p0.Equals2D(p1)) 
                return 0;

            int xSign = RelativeSign(p0.X, p1.X);
            int ySign = RelativeSign(p0.Y, p1.Y);

            switch (octant)
            {
                case Octants.Zero: 
                    return CompareValue(xSign, ySign);
                case Octants.One:
                    return CompareValue(ySign, xSign);
                case Octants.Two:
                    return CompareValue(ySign, -xSign);
                case Octants.Three:
                    return CompareValue(-xSign, ySign);
                case Octants.Four:
                    return CompareValue(-xSign, -ySign);
                case Octants.Five:
                    return CompareValue(-ySign, -xSign);
                case Octants.Six:
                    return CompareValue(-ySign, xSign);
                case Octants.Seven:
                    return CompareValue(xSign, -ySign);
            }

            Assert.ShouldNeverReachHere("invalid octant value: " + octant);
            return 0;
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:44,代码来源:SegmentPointComparator.cs

示例2: SegmentNode

 /// <summary>
 /// Initializes a new instance of the <see cref="SegmentNode"/> class.
 /// </summary>
 /// <param name="segString"></param>
 /// <param name="coord"></param>
 /// <param name="segmentIndex"></param>
 /// <param name="segmentOctant"></param>
 public SegmentNode(SegmentString segString, ICoordinate coord, int segmentIndex, Octants segmentOctant)
 {
     this.segString = segString;
     this.Coordinate = new Coordinate(coord);
     this.SegmentIndex = segmentIndex;
     this.segmentOctant = segmentOctant;
     isInterior = !coord.Equals2D(segString.GetCoordinate(segmentIndex));
 }
开发者ID:izambakci,项目名称:tf-net,代码行数:15,代码来源:SegmentNode.cs

示例3: Arc

 private Arc(Circle circle, ICoordinate p1, ICoordinate p2, bool isClockwise)
 {
     this.p1 = p1;
     this.p2 = p2;
     clockwise = isClockwise;
     p1Angle = circle.GetAngle(p1);
     if (p1.Equals2D(p2))
     {
         p2Angle = TWO_PI + p1Angle;
     }
     else
     {
         p2Angle = circle.GetAngle(p2);
     }
     DetermineArcAngle();
 }
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:16,代码来源:Circle.cs

示例4: FindSnapForVertex

 /// <summary>
 /// 
 /// </summary>
 /// <param name="pt"></param>
 /// <param name="snapPts"></param>
 /// <returns></returns>
 private ICoordinate FindSnapForVertex(ICoordinate pt, ICoordinate[] snapPts)
 {
     foreach (ICoordinate coord in snapPts)
     {
         // if point is already equal to a src pt, don't snap
         if (pt.Equals2D(coord))
             return null;
         if (pt.Distance(coord) < snapTolerance)
             return coord;
     }
     return null;
 }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:18,代码来源:LineStringSnapper.cs

示例5: AddIntersection

        /// <summary>
        /// 
        /// </summary>
        /// <param name="intPt"></param>
        /// <param name="segmentIndex"></param>
        public void AddIntersection(ICoordinate intPt, int segmentIndex)
        {
            var normalizedSegmentIndex = segmentIndex;
            // normalize the intersection point location
            var nextSegIndex = normalizedSegmentIndex + 1;
            if(nextSegIndex < pts.Length)
            {
                var nextPt = pts[nextSegIndex];
              
                // Normalize segment index if intPt falls on vertex
                // The check for point equality is 2D only - Z values are ignored
                if (intPt.Equals2D(nextPt))
                    normalizedSegmentIndex = nextSegIndex;                
            }

            // Add the intersection point to edge intersection list.
            var ei = nodeList.Add(intPt, normalizedSegmentIndex);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:23,代码来源:SegmentString.cs


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