My Project
Loading...
Searching...
No Matches
CCollisionAABBTree.h
Go to the documentation of this file.
1//==============================================================================
2/*
3 Software License Agreement (BSD License)
4 Copyright (c) 2003-2024, CHAI3D
5 (www.chai3d.org)
6
7 All rights reserved.
8
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions
11 are met:
12
13 * Redistributions of source code must retain the above copyright
14 notice, this list of conditions and the following disclaimer.
15
16 * Redistributions in binary form must reproduce the above
17 copyright notice, this list of conditions and the following
18 disclaimer in the documentation and/or other materials provided
19 with the distribution.
20
21 * Neither the name of CHAI3D nor the names of its contributors may
22 be used to endorse or promote products derived from this software
23 without specific prior written permission.
24
25 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29 COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 POSSIBILITY OF SUCH DAMAGE.
37
38 \author <http://www.chai3d.org>
39 \author Chris Sewell
40 \author Charity Lu
41 \author Francois Conti
42 \version 3.3.0
43*/
44//==============================================================================
45
46//------------------------------------------------------------------------------
47#ifndef CCollisionAABBTreeH
48#define CCollisionAABBTreeH
49//------------------------------------------------------------------------------
53//------------------------------------------------------------------------------
54namespace chai3d {
55//------------------------------------------------------------------------------
56
57//==============================================================================
64//==============================================================================
65
66//------------------------------------------------------------------------------
74
75//------------------------------------------------------------------------------
76
77//==============================================================================
85//==============================================================================
87{
88 //--------------------------------------------------------------------------
89 // CONSTRUCTOR & DESTRUCTOR:
90 //--------------------------------------------------------------------------
91
92public:
93
96
99
100
101 //--------------------------------------------------------------------------
102 // PUBLIC METHODS:
103 //--------------------------------------------------------------------------
104
105public:
106
108 void fitBBox(double a_radius,
109 cVector3d& a_vertex0);
110
112 void fitBBox(double a_radius,
113 cVector3d& a_vertex0,
114 cVector3d& a_vertex1);
115
117 void fitBBox(double a_radius,
118 cVector3d& a_vertex0,
119 cVector3d& a_vertex1,
120 cVector3d& a_vertex2);
121
123 void render(int a_depth = -1);
124
127 cVector3d& a_segmentPointA,
128 cVector3d& a_segmentDirection,
129 cCollisionAABBBox& a_lineBox,
130 cCollisionRecorder& a_recorder,
131 cCollisionSettings& a_settings);
132
133
134 //--------------------------------------------------------------------------
135 // PUBLIC MEMBERS:
136 //--------------------------------------------------------------------------
137
138public:
139
142
145
148
151
154};
155
156
157//------------------------------------------------------------------------------
158} // namespace chai3d
159//------------------------------------------------------------------------------
160
161//------------------------------------------------------------------------------
162#endif
163//------------------------------------------------------------------------------
164
Implements an axis-aligned bounding box collision tree (AABB)
Implements an axis-aligned bounding box collision tree (AABB)
Implements basic data structures for storing collision events.
This class implements a collision detection recorder that stores all collision events that are report...
Definition CCollisionBasics.h:186
This class implements a base class for all 2D or 3D objects in CHAI3D.
Definition CGenericObject.h:113
Definition CAudioBuffer.cpp:57
cAABBNodeType
Internal AABB Node Types.
Definition CCollisionAABBTree.h:69
@ C_AABB_NODE_LEAF
Definition CCollisionAABBTree.h:71
@ C_AABB_NODE_INTERNAL
Definition CCollisionAABBTree.h:70
@ C_AABB_NOT_DEFINED
Definition CCollisionAABBTree.h:72
This structure implements the boundary nodes of an axis-aligned bounding box.
Definition CCollisionAABBBox.h:85
This structure implements a tree node inside an AABB collision tree.
Definition CCollisionAABBTree.h:87
bool computeCollision(cGenericObject *a_owner, cVector3d &a_segmentPointA, cVector3d &a_segmentDirection, cCollisionAABBBox &a_lineBox, cCollisionRecorder &a_recorder, cCollisionSettings &a_settings)
This method determines whether a line segment intersects any elements covered by this node.
virtual ~cCollisionAABBNode()
Destructor of cCollisionAABBNode.
Definition CCollisionAABBTree.h:98
cCollisionAABBNode()
Constructor of cCollisionAABBNode.
Definition CCollisionAABBTree.cpp:60
cCollisionAABBBox m_bbox
Bounding box for this node.
Definition CCollisionAABBTree.h:141
int m_leftSubTree
Left child node index.
Definition CCollisionAABBTree.h:150
cAABBNodeType m_nodeType
Node type.
Definition CCollisionAABBTree.h:147
void render(int a_depth=-1)
This method draws the edges of the boundary box for this node, if at the given depth.
Definition CCollisionAABBTree.cpp:182
void fitBBox(double a_radius, cVector3d &a_vertex0)
This method creates a boundary box for a point.
Definition CCollisionAABBTree.cpp:79
int m_rightSubTree
Right child node index.
Definition CCollisionAABBTree.h:153
int m_depth
Depth of this node in the collision tree.
Definition CCollisionAABBTree.h:144
This structure stores the collision settings that are passed to a collision detector when querying fo...
Definition CCollisionBasics.h:243
This class implements a 3D vector.
Definition CVector3d.h:89