public bool HasCollision(ICollidablePrimitive other) { #region Argument Check if (other == null) { throw new ArgumentNullException("other"); } #endregion var otherCpp = other as ConvexPolygonPrimitive; if (otherCpp != null) { return(CollisionDetector.CheckPolygonToPolygonCollision(this, otherCpp)); } var line = other as LinePrimitive; if (line != null) { return(CollisionDetector.CheckLineToPolygonCollision(line, this)); } var circle = other as CirclePrimitive; if (circle != null) { return(CollisionDetector.CheckCircleToPolygonCollision(circle, this)); } throw new NotSupportedException(); }