示例#1
0
        public override object Clone()
        {
            CompositeMask mask = new CompositeMask(this);
            mask._pos = _pos;

            return mask;
        }
示例#2
0
        public void Merge(CompositeMask mask)
        {
            RectangleFP rect = mask.Bounds;

            FPInt minx = FPMath.Min(_bounds.Left, rect.Left);
            FPInt maxx = FPMath.Max(_bounds.Right, rect.Right);
            FPInt miny = FPMath.Min(_bounds.Top, rect.Top);
            FPInt maxy = FPMath.Min(_bounds.Bottom, rect.Bottom);

            _bounds = new RectangleFP(minx, miny, maxx - minx, maxy - miny);

            foreach (Mask m in mask._components) {
                _components.Add(mask);
            }
        }
示例#3
0
 private Mask BuildCom(Mask m1, Mask m2)
 {
     CompositeMask com = new CompositeMask(m1);
     com.Add(m2);
     return com;
 }
示例#4
0
        public static bool TestOverlap(CompositeMask comMask1, CompositeMask comMask2)
        {
            if (!comMask1.Bounds.Intersects(comMask2.Bounds)) {
                return false;
            }

            foreach (Mask m1 in comMask1._components) {
                if (!m1.Bounds.Intersects(comMask2.Bounds)) {
                    return false;
                }

                foreach (Mask m2 in comMask2._components) {
                    if (m1.TestOverlap(m2)) {
                        return true;
                    }
                }
            }

            return false;
        }
示例#5
0
 public static bool TestOverlap(CompositeMask comMask, Mask mask)
 {
     return TestOverlap(mask, comMask);
 }
示例#6
0
        public static bool TestOverlap(Mask mask, CompositeMask comMask)
        {
            if (!mask.Bounds.Intersects(comMask.Bounds)) {
                return false;
            }

            foreach (Mask m in comMask._components) {
                if (mask.TestOverlap(m)) {
                    return true;
                }
            }

            return false;
        }
示例#7
0
        public static bool TestOverlap(AYLine yl, CompositeMask comMask)
        {
            RectangleFP comBounds = comMask.Bounds;
            if (yl.X >= comBounds.Right || yl.X <= comBounds.Left || yl.Bottom <= comBounds.Top || yl.Top >= comBounds.Bottom) {
                return false;
            }

            foreach (Mask m in comMask._components) {
                if (m.TestOverlap(yl)) {
                    return true;
                }
            }

            return false;
        }
示例#8
0
        // Composite -- [____] Collision Tests
        public static bool TestOverlap(AXLine xl, CompositeMask comMask)
        {
            RectangleFP comBounds = comMask.Bounds;
            if (xl.Left >= comBounds.Right || xl.Right <= comBounds.Left || xl.Y <= comBounds.Top || xl.Y >= comBounds.Bottom) {
                return false;
            }

            foreach (Mask m in comMask._components) {
                if (m.TestOverlap(xl)) {
                    return true;
                }
            }

            return false;
        }