public override object Clone() { CompositeMask mask = new CompositeMask(this); mask._pos = _pos; return mask; }
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); } }
private Mask BuildCom(Mask m1, Mask m2) { CompositeMask com = new CompositeMask(m1); com.Add(m2); return com; }
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; }
public static bool TestOverlap(CompositeMask comMask, Mask mask) { return TestOverlap(mask, comMask); }
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; }
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; }
// 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; }