Beispiel #1
0
        public static bool IsCrashed(DDCrash a, DDCrash b)
        {
            if ((int)b.Kind < (int)a.Kind)
            {
                DDCrash tmp = a;
                a = b;
                b = tmp;
            }
            if (a.Kind == Kind_e.NONE)
            {
                return(false);
            }

            if (b.Kind == Kind_e.MULTI)
            {
                return(IsCrashed_Any_Multi(a, b));
            }

            if (a.Kind == Kind_e.POINT)
            {
                if (b.Kind == Kind_e.POINT)
                {
                    return(false);
                }

                if (b.Kind == Kind_e.CIRCLE)
                {
                    return(DDUtils.IsCrashed_Circle_Point(b.Pt, b.R, a.Pt));
                }

                if (b.Kind == Kind_e.RECT)
                {
                    return(DDUtils.IsCrashed_Rect_Point(b.Rect, a.Pt));
                }

                if (b.Kind == Kind_e.MULTI)
                {
                    throw new DDError();
                }
            }
            if (a.Kind == Kind_e.CIRCLE)
            {
                if (b.Kind == Kind_e.CIRCLE)
                {
                    return(DDUtils.IsCrashed_Circle_Circle(a.Pt, a.R, b.Pt, b.R));
                }

                if (b.Kind == Kind_e.RECT)
                {
                    return(DDUtils.IsCrashed_Circle_Rect(a.Pt, a.R, b.Rect));
                }

                throw new DDError();
            }
            if (a.Kind == Kind_e.RECT)
            {
                if (b.Kind == Kind_e.RECT)
                {
                    return(DDUtils.IsCrashed_Rect_Rect(a.Rect, b.Rect));
                }

                throw new DDError();
            }
            throw new DDError();
        }