boolean FillPolygonObj::Intersects (BoxObj& ub) { BoxObj b; GetBox(b); if (!b.Intersects(ub)) { return false; } if (b.Within(ub)) { return true; } LineObj bottom(ub._left, ub._bottom, ub._right, ub._bottom); if (Intersects(bottom)) { return true; } LineObj right(ub._right, ub._bottom, ub._right, ub._top); if (Intersects(right)) { return true; } LineObj top(ub._right, ub._top, ub._left, ub._top); if (Intersects(top)) { return true; } LineObj left(ub._left, ub._top, ub._left, ub._bottom); return Intersects(left); }
Graphic* Picture::LastGraphicWithin (BoxObj& userb) { Iterator i; BoxObj b; for (Last(i); !Done(i); Prev(i)) { Graphic* subgr = GetGraphic(i); subgr->GetBox(b); if (b.Within(userb)) { return subgr; } } return nil; }
void Damage::Incur (BoxObj& newb) { BoxObj* b; Iterator i; if (_areas->IsEmpty()) { _areas->Prepend(new UList(new BoxObj(&newb))); } else if (_areas->First() == _areas->Last()) { FirstArea(i); b = GetArea(i); if (newb.Intersects(*b)) { if (!newb.Within(*b)) { *b = *b + newb; } } else { _areas->Prepend(new UList(new BoxObj(&newb))); } } else { Merge(newb); } }
boolean MultiLineObj::Within (BoxObj& userb) { BoxObj b; GetBox(b); return b.Within(userb); }