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