/indra/llmath/llbboxlocal.h

https://bitbucket.org/lindenlab/viewer-beta/ · C++ Header · 65 lines · 25 code · 14 blank · 26 comment · 0 complexity · 669863758413e2ea319944061a312c1f MD5 · raw file

  1. /**
  2. * @file llbboxlocal.h
  3. * @brief General purpose bounding box class.
  4. *
  5. * $LicenseInfo:firstyear=2001&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_BBOXLOCAL_H
  27. #define LL_BBOXLOCAL_H
  28. #include "v3math.h"
  29. class LLMatrix4;
  30. class LLBBoxLocal
  31. {
  32. public:
  33. LLBBoxLocal() {}
  34. LLBBoxLocal( const LLVector3& min, const LLVector3& max ) : mMin( min ), mMax( max ) {}
  35. // Default copy constructor is OK.
  36. const LLVector3& getMin() const { return mMin; }
  37. void setMin( const LLVector3& min ) { mMin = min; }
  38. const LLVector3& getMax() const { return mMax; }
  39. void setMax( const LLVector3& max ) { mMax = max; }
  40. LLVector3 getCenter() const { return (mMax - mMin) * 0.5f + mMin; }
  41. LLVector3 getExtent() const { return mMax - mMin; }
  42. void addPoint(const LLVector3& p);
  43. void addBBox(const LLBBoxLocal& b) { addPoint( b.mMin ); addPoint( b.mMax ); }
  44. void expand( F32 delta );
  45. friend LLBBoxLocal operator*(const LLBBoxLocal& a, const LLMatrix4& b);
  46. private:
  47. LLVector3 mMin;
  48. LLVector3 mMax;
  49. };
  50. LLBBoxLocal operator*(const LLBBoxLocal &a, const LLMatrix4 &b);
  51. #endif // LL_BBOXLOCAL_H