TORCS  1.3.9
The Open Racing Car Simulator
Complex.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 _COMPLEX_H_
28 #define _COMPLEX_H_
29 
30 #ifdef _MSC_VER
31 #pragma warning(disable:4786) // identifier was truncated to '255'
32 #endif // _MSC_VER
33 
34 #include <algorithm>
35 
36 #include "Shape.h"
37 #include "VertexBase.h"
38 
39 class BBoxNode;
40 class BBoxLeaf;
41 
42 class Polytope;
43 class Convex;
44 class Transform;
45 class BBox;
46 
47 class Complex : public Shape {
48 public:
49  Complex() {}
50  ~Complex();
51 
52  ShapeType getType() const { return COMPLEX; }
53  BBox bbox(const Transform& t) const;
54 
55  const VertexBase& getBase() const { return base; }
56  void setBase(const Point *ptr, bool free = false) {
57  base = ptr; free_base = free;
58  }
59  void changeBase(const Point *ptr);
60  void proceed() { prev_base = base; }
61  void swapBase() { swap(base, prev_base); }
62 
63  void finish(int n, const Polytope **p);
64 
65  friend bool intersect(const Complex& a, const Convex& b,
66  const Transform& a2w, const Transform& b2w,
67  Vector& v);
68 
69  friend bool intersect(const Complex& a, const Complex& b,
70  const Transform& a2w, const Transform& b2w,
71  Vector& v);
72 
73  friend bool find_prim(const Complex& a, const Convex& b,
74  const Transform& a2w, const Transform& b2w,
75  Vector& v, ShapePtr& p);
76 
77  friend bool find_prim(const Complex& a, const Complex& b,
78  const Transform& a2w, const Transform& b2w,
79  Vector& v, ShapePtr& pa, ShapePtr& pb);
80 
81  friend bool common_point(const Complex& a, const Convex& b,
82  const Transform& a2w, const Transform& b2w,
83  Vector& v, Point& pa, Point& pb);
84 
85  friend bool common_point(const Complex& a, const Complex& b,
86  const Transform& a2w, const Transform& b2w,
87  Vector& v, Point& pa, Point& pb);
88 
89 private:
92  bool free_base;
95  int count;
96 };
97 
98 #endif
void finish(int n, const Polytope **p)
Definition: Complex.cpp:65
Definition: Shape.h:40
VertexBase prev_base
Definition: Complex.h:91
Definition: Convex.h:39
friend bool intersect(const Complex &a, const Convex &b, const Transform &a2w, const Transform &b2w, Vector &v)
Definition: Complex.cpp:79
void swapBase()
Definition: Complex.h:61
Complex()
Definition: Complex.h:49
ShapeType
Definition: Shape.h:39
int count
Definition: Complex.h:95
const VertexBase & getBase() const
Definition: Complex.h:55
BBoxNode * root
Definition: Complex.h:94
static Point p[4]
Definition: Convex.cpp:54
Definition: Shape.h:44
Definition: BBox.h:36
VertexBase base
Definition: Complex.h:90
BBox bbox(const Transform &t) const
Definition: Complex.cpp:49
bool free_base
Definition: Complex.h:92
friend bool common_point(const Complex &a, const Convex &b, const Transform &a2w, const Transform &b2w, Vector &v, Point &pa, Point &pb)
Definition: Complex.cpp:119
BBoxLeaf * leaves
Definition: Complex.h:93
~Complex()
Definition: Complex.cpp:39
ShapeType getType() const
Definition: Complex.h:52
void proceed()
Definition: Complex.h:60
Definition: Vector.h:32
void changeBase(const Point *ptr)
Definition: Complex.cpp:59
void setBase(const Point *ptr, bool free=false)
Definition: Complex.h:56
Definition: Point.h:34
friend bool find_prim(const Complex &a, const Convex &b, const Transform &a2w, const Transform &b2w, Vector &v, ShapePtr &p)
Definition: Complex.cpp:99