TORCS  1.3.9
The Open Racing Car Simulator
Encounter.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 _ENCOUNTER_H_
28 #define _ENCOUNTER_H_
29 
30 #ifdef _MSC_VER
31 #pragma warning(disable:4786) // identifier was truncated to '255'
32 #endif // _MSC_VER
33 
34 #include <3D/Vector.h>
35 #include "Object.h"
36 
37 typedef const Object *ObjectPtr;
38 
39 class Encounter {
40 public:
44 
46  if (o2->shapePtr->getType() < o1->shapePtr->getType() ||
47  (o2->shapePtr->getType() == o1->shapePtr->getType() && o2 < o1)) {
48  obj1 = o2;
49  obj2 = o1;
50  }
51  else {
52  obj1 = o1;
53  obj2 = o2;
54  }
55  sep_axis.setValue(0, 0, 0);
56  }
57 };
58 
59 inline bool operator<(const Encounter& x, const Encounter& y) {
60  return x.obj1 < y.obj1 || (!(y.obj1 < x.obj1) && x.obj2 < y.obj2);
61 }
62 
63 #endif
ObjectPtr obj2
Definition: Encounter.h:42
void setValue(const float v[3])
Definition: Tuple3.h:50
ObjectPtr obj1
Definition: Encounter.h:41
bool operator<(const Encounter &x, const Encounter &y)
Definition: Encounter.h:59
const Object * ObjectPtr
Definition: Encounter.h:37
virtual ShapeType getType() const =0
ShapePtr shapePtr
Definition: Object.h:65
Encounter(ObjectPtr o1, ObjectPtr o2)
Definition: Encounter.h:45
static Vector y[4]
Definition: Convex.cpp:56
Definition: Vector.h:32
Definition: Object.h:41
Vector sep_axis
Definition: Encounter.h:43