TORCS  1.3.9
The Open Racing Car Simulator
BBoxTree.h
Go to the documentation of this file.
1 /*
2  SOLID - Software Library for Interference Detection
3  Copyright (C) 1997-1998 Gino van den Bergen
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public
16  License along with this library; if not, write to the Free
17  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 
19  Please send remarks, questions and bug reports to gino@win.tue.nl,
20  or write to:
21  Gino van den Bergen
22  Department of Mathematics and Computing Science
23  Eindhoven University of Technology
24  P.O. Box 513, 5600 MB Eindhoven, The Netherlands
25 */
26 
27 #ifndef _BBOXTREE_H_
28 #define _BBOXTREE_H_
29 
30 #ifdef _MSC_VER
31 #pragma warning(disable:4786) // identifier was truncated to '255'
32 #endif // _MSC_VER
33 
34 #include "BBox.h"
35 #include "Polytope.h"
36 
37 class Convex;
38 class Transform;
39 class Matrix;
40 
41 class BBoxNode {
42 public:
43  enum TagType { LEAF, INTERNAL };
44 
46 
48 };
49 
50 class BBoxLeaf : public BBoxNode {
51 public:
52  const Polytope *poly;
53 
54  BBoxLeaf() {}
55  BBoxLeaf(const Polytope *p) : poly(p) {
56  tag = LEAF;
57  fitBBox();
58  }
59 
60  void fitBBox();
61 };
62 
63 class BBoxInternal : public BBoxNode {
64 public:
67 
69  BBoxInternal(int n, BBoxLeaf *l);
70 
72 };
73 
74 
75 
76 bool intersect(const BBoxNode *tree, const Convex& c, const BBox& bb,
77  const Transform& b2a, Vector& v);
78 
79 bool intersect(const BBoxNode *a, const BBoxNode *b,
80  const Transform& b2a, const Matrix& abs_b2a,
81  const Transform& a2b, const Matrix& abs_a2b, Vector& v);
82 
83 bool find_prim(const BBoxNode *tree, const Convex& c, const BBox& bb,
84  const Transform& b2a, Vector& v, ShapePtr& p);
85 
86 bool find_prim(const BBoxNode *a, const BBoxNode *b,
87  const Transform& b2a, const Matrix& abs_b2a,
88  const Transform& a2b, const Matrix& abs_a2b,
89  Vector& v, ShapePtr& pa, ShapePtr& pb);
90 
91 bool common_point(const BBoxNode *tree, const Convex& c, const BBox& bb,
92  const Transform& b2a, Vector& v, Point& pa, Point& pb);
93 
94 bool common_point(const BBoxNode *a, const BBoxNode *b,
95  const Transform& b2a, const Matrix& abs_b2a,
96  const Transform& a2b, const Matrix& abs_a2b,
97  Vector& v, Point& pa, Point& pb);
98 
99 #endif
100 
101 
102 
103 
104 
105 
BBoxNode * rson
Definition: BBoxTree.h:66
Definition: Convex.h:39
void fitBBox()
Definition: BBoxTree.cpp:49
void refitBBox()
Definition: BBoxTree.h:71
BBoxLeaf(const Polytope *p)
Definition: BBoxTree.h:55
BBoxLeaf()
Definition: BBoxTree.h:54
BBox bbox
Definition: BBoxTree.h:45
BBoxNode * lson
Definition: BBoxTree.h:65
bool find_prim(const BBoxNode *tree, const Convex &c, const BBox &bb, const Transform &b2a, Vector &v, ShapePtr &p)
Definition: BBoxTree.cpp:154
void enclose(const BBox &a, const BBox &b)
Definition: BBox.h:52
static Point p[4]
Definition: Convex.cpp:54
Definition: Shape.h:44
Definition: BBox.h:36
TagType tag
Definition: BBoxTree.h:47
Definition: Matrix.h:37
const Polytope * poly
Definition: BBoxTree.h:52
BBoxInternal()
Definition: BBoxTree.h:68
bool intersect(const BBoxNode *tree, const Convex &c, const BBox &bb, const Transform &b2a, Vector &v)
Definition: BBoxTree.cpp:115
Definition: Vector.h:32
bool common_point(const BBoxNode *tree, const Convex &c, const BBox &bb, const Transform &b2a, Vector &v, Point &pa, Point &pb)
Definition: BBoxTree.cpp:204
Definition: Point.h:34