本文整理汇总了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;
}
示例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));
}
示例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();
}
示例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;
}
示例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);
}