torcs - 1.2.2

src/modules/simu/simuv2.sav/SOLID-2.0/src/BBoxTree.h

Go to the documentation of this file.
00001 /*
00002   SOLID - Software Library for Interference Detection
00003   Copyright (C) 1997-1998  Gino van den Bergen
00004 
00005   This library is free software; you can redistribute it and/or
00006   modify it under the terms of the GNU Library General Public
00007   License as published by the Free Software Foundation; either
00008   version 2 of the License, or (at your option) any later version.
00009 
00010   This library is distributed in the hope that it will be useful,
00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013   Library General Public License for more details.
00014 
00015   You should have received a copy of the GNU Library General Public
00016   License along with this library; if not, write to the Free
00017   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 
00019   Please send remarks, questions and bug reports to gino@win.tue.nl,
00020   or write to:
00021                   Gino van den Bergen
00022                   Department of Mathematics and Computing Science
00023                   Eindhoven University of Technology
00024                   P.O. Box 513, 5600 MB Eindhoven, The Netherlands
00025 */
00026 
00027 #ifndef _BBOXTREE_H_
00028 #define _BBOXTREE_H_
00029 
00030 #include "BBox.h"
00031 #include "Polytope.h"
00032 
00033 class Convex;
00034 class Transform;
00035 class Matrix;
00036 
00037 class BBoxNode {
00038 public:
00039   enum TagType { LEAF, INTERNAL };
00040 
00041   BBox bbox;
00042 
00043   TagType tag;
00044 };
00045 
00046 class BBoxLeaf : public BBoxNode {
00047 public:
00048   const Polytope *poly;
00049 
00050   BBoxLeaf() {}
00051   BBoxLeaf(const Polytope *p) : poly(p) { 
00052     tag = LEAF;
00053     fitBBox(); 
00054   }
00055 
00056   void fitBBox();
00057 };
00058 
00059 class BBoxInternal : public BBoxNode {
00060 public:
00061   BBoxNode *lson;
00062   BBoxNode *rson;
00063 
00064   BBoxInternal() {}
00065   BBoxInternal(int n, BBoxLeaf *l);
00066 
00067   void refitBBox() { bbox.enclose(lson->bbox, rson->bbox); }
00068 };
00069 
00070 
00071 
00072 bool intersect(const BBoxNode *tree, const Convex& c, const BBox& bb,
00073                const Transform& b2a, Vector& v);
00074 
00075 bool intersect(const BBoxNode *a, const BBoxNode *b,
00076                const Transform& b2a, const Matrix& abs_b2a,
00077                const Transform& a2b, const Matrix& abs_a2b, Vector& v);
00078 
00079 bool find_prim(const BBoxNode *tree, const Convex& c, const BBox& bb,
00080                const Transform& b2a, Vector& v, ShapePtr& p);
00081 
00082 bool find_prim(const BBoxNode *a, const BBoxNode *b,
00083                const Transform& b2a, const Matrix& abs_b2a,
00084                const Transform& a2b, const Matrix& abs_a2b,
00085                Vector& v, ShapePtr& pa, ShapePtr& pb);
00086 
00087 bool common_point(const BBoxNode *tree, const Convex& c, const BBox& bb,
00088                   const Transform& b2a, Vector& v, Point& pa, Point& pb);
00089 
00090 bool common_point(const BBoxNode *a, const BBoxNode *b,
00091                   const Transform& b2a, const Matrix& abs_b2a,
00092                   const Transform& a2b, const Matrix& abs_a2b,
00093                   Vector& v, Point& pa, Point& pb);
00094 
00095 #endif
00096 
00097 
00098 
00099 
00100 
00101 

Generated at Thu Feb 26 21:52:31 2004 for torcs by doxygen 1.3.3 written by Dimitri van Heesch, © 1997-1999
TORCS © Eric Espié 1999, 2002.