Advertisement
mixster

mixster

Jun 14th, 2009
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.58 KB | None | 0 0
  1. program New;
  2. var
  3.   TBox1, TBox2: TBox;
  4. function DoBoxesOverlap(tb1, tb2: TBox): Boolean;
  5. begin
  6.   Result := False;
  7.   if (not (InRange(tb1.x1, tb2.x1, tb2.x2))) then
  8.     if (not (InRange(tb1.x2, tb2.x1, tb2.x2))) then
  9.       exit;
  10.   if (not (InRange(tb1.y1, tb2.y1, tb2.y2))) then
  11.     if (not (InRange(tb1.y2, tb2.y1, tb2.y2))) then
  12.       exit;
  13.   Result := True;
  14. end;
  15.  
  16. begin
  17.   Writeln('begin');
  18.   TBox1 := IntToBox(0, 0, 20, 20);
  19.   TBox2 := IntToBox(5, 5, 30, 30);
  20.   if DoBoxesOverlap(TBox1, TBox2) then
  21.     Writeln('Yes')
  22.   else
  23.     Writeln('No');
  24.   Writeln('end');
  25. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement