torcs - 1.2.2

src/modules/simu/simuv2.sav/SOLID-2.0/src/Complex.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 _COMPLEX_H_
00028 #define _COMPLEX_H_
00029 
00030 #include <algorithm>
00031 
00032 #include "Shape.h"
00033 #include "VertexBase.h"
00034 
00035 class BBoxNode;
00036 class BBoxLeaf;
00037 
00038 class Polytope;
00039 class Convex;
00040 class Transform;
00041 class BBox;
00042 
00043 class Complex : public Shape {
00044 public:
00045   Complex() {}
00046   ~Complex();
00047 
00048   ShapeType getType() const { return COMPLEX; } 
00049   BBox bbox(const Transform& t) const;
00050 
00051   const VertexBase& getBase() const { return base; } 
00052   void setBase(const void *ptr, bool free = false) { 
00053     base = ptr; free_base = free; 
00054   } 
00055   void changeBase(const void *ptr);
00056   void proceed() { prev_base = base; }
00057   void swapBase() { swap(base, prev_base); } 
00058 
00059   void finish(int n, const Polytope **p);
00060 
00061   friend bool intersect(const Complex& a, const Convex& b,
00062                         const Transform& a2w, const Transform& b2w,
00063                         Vector& v);
00064   
00065   friend bool intersect(const Complex& a, const Complex& b,
00066                         const Transform& a2w, const Transform& b2w,
00067                         Vector& v);
00068   
00069   friend bool find_prim(const Complex& a, const Convex& b, 
00070                         const Transform& a2w, const Transform& b2w,
00071                         Vector& v, ShapePtr& p);
00072   
00073   friend bool find_prim(const Complex& a, const Complex& b,
00074                         const Transform& a2w, const Transform& b2w,
00075                         Vector& v, ShapePtr& pa, ShapePtr& pb);
00076   
00077   friend  bool common_point(const Complex& a, const Convex& b,
00078                             const Transform& a2w, const Transform& b2w,
00079                             Vector& v, Point& pa, Point& pb);
00080   
00081   friend bool common_point(const Complex& a, const Complex& b,
00082                            const Transform& a2w, const Transform& b2w,
00083                            Vector& v, Point& pa, Point& pb);
00084                         
00085 private:
00086   VertexBase base;
00087   VertexBase prev_base;
00088   bool free_base;
00089   BBoxLeaf *leaves;
00090   BBoxNode *root;
00091   int count;
00092 };
00093 
00094 #endif

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.