TORCS  1.3.10
The Open Racing Car Simulator
Loading...
Searching...
No Matches
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
37class Convex;
38class Transform;
39class Matrix;
40
41class BBoxNode {
42public:
44
46
48};
49
50class BBoxLeaf : public BBoxNode {
51public:
52 const Polytope *poly;
53
55 BBoxLeaf(const Polytope *p) : poly(p) {
56 tag = LEAF;
57 fitBBox();
58 }
59
60 void fitBBox();
61};
62
63class BBoxInternal : public BBoxNode {
64public:
67
69 BBoxInternal(int n, BBoxLeaf *l);
70
71 void refitBBox() { bbox.enclose(lson->bbox, rson->bbox); }
72};
73
74
75
76bool intersect(const BBoxNode *tree, const Convex& c, const BBox& bb,
77 const Transform& b2a, Vector& v);
78
79bool 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
83bool find_prim(const BBoxNode *tree, const Convex& c, const BBox& bb,
84 const Transform& b2a, Vector& v, ShapePtr& p);
85
86bool 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
91bool common_point(const BBoxNode *tree, const Convex& c, const BBox& bb,
92 const Transform& b2a, Vector& v, Point& pa, Point& pb);
93
94bool 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
bool intersect(const BBoxNode *tree, const Convex &c, const BBox &bb, const Transform &b2a, Vector &v)
Definition BBoxTree.cpp:115
bool find_prim(const BBoxNode *tree, const Convex &c, const BBox &bb, const Transform &b2a, Vector &v, ShapePtr &p)
Definition BBoxTree.cpp:154
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
static Point p[4]
Definition Convex.cpp:54
const Shape * ShapePtr
Definition Shape.h:51
Definition BBox.h:36
BBoxNode * lson
Definition BBoxTree.h:65
BBoxNode * rson
Definition BBoxTree.h:66
void refitBBox()
Definition BBoxTree.h:71
BBoxLeaf()
Definition BBoxTree.h:54
BBoxLeaf(const Polytope *p)
Definition BBoxTree.h:55
const Polytope * poly
Definition BBoxTree.h:52
void fitBBox()
Definition BBoxTree.cpp:49
@ INTERNAL
Definition BBoxTree.h:43
BBox bbox
Definition BBoxTree.h:45
TagType tag
Definition BBoxTree.h:47
Definition Point.h:34