home *** CD-ROM | disk | FTP | other *** search
/ Quake 'em / QUAKEEM.BIN / doom_i / program / reject10.exe / SOURCE.ZIP / SECTOR.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-31  |  1.5 KB  |  46 lines

  1. //**********************************************************************************
  2. //    REJECT.EXE - Reject data table builder for DOOM
  3. //    Copyright (C) 1994 L.M.WITEK 
  4. //
  5. //    This program is free software; you can redistribute it and/or modify
  6. //    it under the terms of the GNU General Public License as published by
  7. //    the Free Software Foundation; either version 1, or (at your option)
  8. //    any later version.
  9. //
  10. //    This program is distributed in the hope that it will be useful,
  11. //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. //    GNU General Public License for more details.
  14. //
  15. //    You should have received a copy of the GNU General Public License
  16. //    along with this program; if not, write to the Free Software
  17. //    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. //**********************************************************************************
  19.  
  20. #include "sector.hpp"
  21.  
  22. #define max(a,b)            (((a) > (b)) ? (a) : (b))
  23. #define min(a,b)            (((a) < (b)) ? (a) : (b))
  24.  
  25.  
  26. CSector::CSector ()
  27.         : max_x (-32768), max_y (-32768), min_x (32767), min_y (32767)
  28. {
  29. }
  30.  
  31. void CSector::AddVertex (VERTEX &v)
  32. {
  33.      max_x = max (max_x, v.x);
  34.      max_y = max (max_y, v.y);
  35.      min_x = min (min_x, v.x);
  36.      min_y = min (min_y, v.y);
  37. }
  38.  
  39. void CSector::GetCenter (SWORD &x, SWORD &y)
  40. {
  41.      x = max_x/2 + min_x/2;
  42.      y = max_y/2 + min_y/2;
  43. }
  44.  
  45.  
  46.