1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2013 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 OgreCapsule.h  -  3D Line-Swept-Sphere class for intersection testing in Ogre3D
28 Some algorithms based off code from the Wild Magic library by Dave Eberly
29 -----------------------------------------------------------------------------
30 begin                : Mon Apr 02 2007
31 author               : Eric Cha
32 email                : ericc@xenopi.com
33 Code Style Update	 :
34 -----------------------------------------------------------------------------
35 */
36 
37 #ifndef CAPSULE_H
38 #define CAPSULE_H
39 
40 #include "OgreSegment.h"
41 
42 namespace Ogre
43 {
44 
45 	class Capsule
46 	{
47 	public:
48 		// construction
49 		Capsule ();  // uninitialized
50 		Capsule (const Segment&, Real);
51 
52 		// set values
53 		void set(const Vector3& newOrigin, const Vector3& newEnd, Real newRadius);
54 		void setOrigin(const Vector3& newOrigin);
55 		void setEndPoint(const Vector3& newEndpoint);
56 		void setRadius(Real newRadius);
57 
58 		// intersection tests
59 		bool intersects(const Capsule&) const;
60 		bool intersects(const Segment&) const;
61 
62 		// defining members
63 		Segment	mSegment;
64 		Real	mRadius;
65 	};
66 }
67 
68 #endif //CAPSULE3_H
69