本文整理汇总了C#中IGeometry.HasCollision方法的典型用法代码示例。如果您正苦于以下问题:C# IGeometry.HasCollision方法的具体用法?C# IGeometry.HasCollision怎么用?C# IGeometry.HasCollision使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGeometry
的用法示例。
在下文中一共展示了IGeometry.HasCollision方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HasCollision
public bool HasCollision(IGeometry other, double tolerance = GeometrySettings.DEFAULT_TOLERANCE)
{
if (other is LineSegment2)
{
return this.InterceptLineWith(other as LineSegment2, tolerance);
}
else if (other is Circle2)
{
return this.InterceptCircleWith(other as Circle2, tolerance);
}
else if (other is Rectangle2)
{
return this.InterceptWithPolygon(((Rectangle2)other).ToPolygon2(), tolerance);
}
else if (other is Arc)
{
return this.InterceptArcWith(other as Arc, tolerance);
}
else
{
return other.HasCollision(this, tolerance);
}
}
示例2: HasCollision
public virtual bool HasCollision(IGeometry other, double tolerance = GeometrySettings.DEFAULT_TOLERANCE)
{
if (other is LineSegment2)
{
return this.InterceptLineWith(other as LineSegment2, tolerance);
}
else if (other is Circle2)
{
return this.InterceptWithCircle(other as Circle2, tolerance);
}
else if (other is Polygon2)
{
return InterceptPolygon(((Polygon2) other), tolerance).Count != 0;
}
else if (other is Rectangle2)
{
return InterceptPolygon(((Rectangle2) other).ToPolygon2(), tolerance).Count != 0;
}
else if (other is Arc)
{
// inverse call:
return other.HasCollision(this, tolerance);
}
else
return this.ToPolygon2().HasCollision(other, tolerance);
}