public bool HasCollision(ICollidablePrimitive other)
        {
            #region Argument Check

            if (other == null)
            {
                throw new ArgumentNullException("other");
            }

            #endregion

            var otherLine = other as LinePrimitive;
            if (otherLine != null)
            {
                return(CollisionDetector.CheckLineToLineCollision(this, otherLine));
            }

            var circle = other as CirclePrimitive;
            if (circle != null)
            {
                return(CollisionDetector.CheckLineToCircleCollision(this, circle));
            }

            var polygon = other as ConvexPolygonPrimitive;
            if (polygon != null)
            {
                return(CollisionDetector.CheckLineToPolygonCollision(this, polygon));
            }

            throw new NotSupportedException();
        }
Beispiel #2
0
        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();
        }