PageRenderTime 31ms CodeModel.GetById 20ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/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
27#ifndef LL_BBOXLOCAL_H
28#define LL_BBOXLOCAL_H
29
30#include "v3math.h"
31
32class LLMatrix4;
33
34class LLBBoxLocal
35{
36public:
37	LLBBoxLocal() {}
38	LLBBoxLocal( const LLVector3& min, const LLVector3& max ) : mMin( min ), mMax( max ) {}
39	// Default copy constructor is OK.
40
41	const LLVector3&	getMin() const					{ return mMin; }
42	void				setMin( const LLVector3& min )	{ mMin = min; }
43
44	const LLVector3&	getMax() const					{ return mMax; }
45	void				setMax( const LLVector3& max )	{ mMax = max; }
46
47	LLVector3			getCenter() const				{ return (mMax - mMin) * 0.5f + mMin; }
48	LLVector3			getExtent() const				{ return mMax - mMin; }
49
50	void				addPoint(const LLVector3& p);
51	void				addBBox(const LLBBoxLocal& b) {	addPoint( b.mMin );	addPoint( b.mMax ); }
52
53	void				expand( F32 delta );
54
55	friend LLBBoxLocal operator*(const LLBBoxLocal& a, const LLMatrix4& b);
56
57private:
58	LLVector3 mMin;
59	LLVector3 mMax;
60};
61
62LLBBoxLocal operator*(const LLBBoxLocal &a, const LLMatrix4 &b);
63
64
65#endif  // LL_BBOXLOCAL_H