PageRenderTime 33ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/llmath/llbboxlocal.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 55 lines | 25 code | 5 blank | 25 comment | 0 complexity | 1cafa2bd28e09d7b6f3c31b4fe520ce6 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llbboxlocal.cpp
  3. * @brief General purpose bounding box class (Not axis aligned).
  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. #include "linden_common.h"
  27. #include "llbboxlocal.h"
  28. #include "m4math.h"
  29. void LLBBoxLocal::addPoint(const LLVector3& p)
  30. {
  31. mMin.mV[VX] = llmin( p.mV[VX], mMin.mV[VX] );
  32. mMin.mV[VY] = llmin( p.mV[VY], mMin.mV[VY] );
  33. mMin.mV[VZ] = llmin( p.mV[VZ], mMin.mV[VZ] );
  34. mMax.mV[VX] = llmax( p.mV[VX], mMax.mV[VX] );
  35. mMax.mV[VY] = llmax( p.mV[VY], mMax.mV[VY] );
  36. mMax.mV[VZ] = llmax( p.mV[VZ], mMax.mV[VZ] );
  37. }
  38. void LLBBoxLocal::expand( F32 delta )
  39. {
  40. mMin.mV[VX] -= delta;
  41. mMin.mV[VY] -= delta;
  42. mMin.mV[VZ] -= delta;
  43. mMax.mV[VX] += delta;
  44. mMax.mV[VY] += delta;
  45. mMax.mV[VZ] += delta;
  46. }
  47. LLBBoxLocal operator*(const LLBBoxLocal &a, const LLMatrix4 &b)
  48. {
  49. return LLBBoxLocal( a.mMin * b, a.mMax * b );
  50. }