PageRenderTime 52ms CodeModel.GetById 34ms app.highlight 13ms RepoModel.GetById 1ms app.codeStats 1ms

/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
 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
27#include "linden_common.h"
28
29#include "llbboxlocal.h"
30#include "m4math.h"
31
32void LLBBoxLocal::addPoint(const LLVector3& p)
33{
34	mMin.mV[VX] = llmin( p.mV[VX], mMin.mV[VX] );
35	mMin.mV[VY] = llmin( p.mV[VY], mMin.mV[VY] );
36	mMin.mV[VZ] = llmin( p.mV[VZ], mMin.mV[VZ] );
37	mMax.mV[VX] = llmax( p.mV[VX], mMax.mV[VX] );
38	mMax.mV[VY] = llmax( p.mV[VY], mMax.mV[VY] );
39	mMax.mV[VZ] = llmax( p.mV[VZ], mMax.mV[VZ] );
40}
41
42void LLBBoxLocal::expand( F32 delta )
43{
44	mMin.mV[VX] -= delta;
45	mMin.mV[VY] -= delta;
46	mMin.mV[VZ] -= delta;
47	mMax.mV[VX] += delta;
48	mMax.mV[VY] += delta;
49	mMax.mV[VZ] += delta;
50}
51
52LLBBoxLocal operator*(const LLBBoxLocal &a, const LLMatrix4 &b)
53{
54	return LLBBoxLocal( a.mMin * b, a.mMax * b );
55}