Example #1
0
        private static bool IsCrashed_Multi_Multi(DDCrash a, DDCrash b)
        {
            //if (a.Kind != Kind_e.MULTI) throw null; // never
            //if (b.Kind != Kind_e.MULTI) throw null; // never

            foreach (DDCrash ac in a.Crashes)
            {
                foreach (DDCrash bc in b.Crashes)
                {
                    if (IsCrashed(ac, bc))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Example #2
0
        private static bool IsCrashed_Any_Multi(DDCrash a, DDCrash b)
        {
            //if (b.Kind != Kind_e.MULTI) throw null; // never

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

            foreach (DDCrash crash in b.Crashes)
            {
                if (IsCrashed(a, crash))
                {
                    return(true);
                }
            }

            return(false);
        }
Example #3
0
 public bool IsCrashed(DDCrash other)
 {
     return(DDCrashUtils.IsCrashed(this, other));
 }
Example #4
0
 public void Draw(DDCrash crash, I3Color color)
 {
     Draw(new DDCrash[] { crash }, color);
 }
Example #5
0
 public void Draw(DDCrash crash)
 {
     Draw(new DDCrash[] { crash });
 }
Example #6
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();
        }