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

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

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

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

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

            return(false);
        }
Example #3
0
 //
 //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
 //
 public void Draw(Crash crash, I3Color color)
 {
     Draw(new Crash[] { crash }, color);
 }
Example #4
0
 //
 //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
 //
 public void Draw(Crash crash)
 {
     Draw(new Crash[] { crash });
 }
Example #5
0
        public static bool IsCrashed(Crash a, Crash b)
        {
            if ((int)b.Kind < (int)a.Kind)
            {
                Crash 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();
        }
Example #6
0
 //
 //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
 //
 public bool IsCrashed(Crash other)
 {
     return(CrashUtils.IsCrashed(this, other));
 }