本文整理汇总了C#中ILine.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# ILine.Equals方法的具体用法?C# ILine.Equals怎么用?C# ILine.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILine
的用法示例。
在下文中一共展示了ILine.Equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Solve
public IIntersectionResult Solve(ILine line, ILine anotherLine)
{
if(line.Equals(anotherLine))
return new IntersectionResult(false, new IPoint[0]);
//Calculation derived from http://devmag.org.za/2009/04/13/basic-collision-detection-in-2d-part-1/
//and http://devmag.org.za/2009/04/17/basic-collision-detection-in-2d-part-2/
return new IntersectionResult(CalculateHasIntersection(line, anotherLine), CalculateIntersectionPoint(line, anotherLine));
}
示例2: FullyOverlaps
public static bool FullyOverlaps(ILine line1, ILine line2)
{
if (line1.Equals(line2))
return true;
if (line1.IsVertical != line2.IsVertical || line1.Length < line2.Length)
{
return false;
}
if (line1.IsVertical)
{
if (line1.Point1.X != line2.Point1.X)
{
return false;
}
return ((line1.Point1.Y <= line2.Point1.Y && line1.Point2.Y >= line2.Point2.Y)
|| (line1.Point2.Y <= line2.Point2.Y && line1.Point1.Y >= line2.Point1.Y));
}
else
{
if (line1.Point1.Y != line2.Point1.Y)
{
return false;
}
return ((line1.Point1.X <= line2.Point1.X && line1.Point2.X >= line2.Point2.X)
|| (line1.Point2.X <= line2.Point2.X && line1.Point1.X >= line2.Point1.X));
}
}