![]() |
torcs - 1.2.2 | ![]() |
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 _ENCOUNTER_H_ 00028 #define _ENCOUNTER_H_ 00029 00030 #include <3D/Vector.h> 00031 #include "Object.h" 00032 00033 typedef const Object *ObjectPtr; 00034 00035 class Encounter { 00036 public: 00037 ObjectPtr obj1; 00038 ObjectPtr obj2; 00039 Vector sep_axis; 00040 00041 Encounter(ObjectPtr o1, ObjectPtr o2) { 00042 if (o2->shapePtr->getType() < o1->shapePtr->getType() || 00043 (o2->shapePtr->getType() == o1->shapePtr->getType() && o2 < o1)) { 00044 obj1 = o2; 00045 obj2 = o1; 00046 } 00047 else { 00048 obj1 = o1; 00049 obj2 = o2; 00050 } 00051 sep_axis.setValue(0, 0, 0); 00052 } 00053 }; 00054 00055 inline bool operator<(const Encounter& x, const Encounter& y) { 00056 return x.obj1 < y.obj1 || (!(y.obj1 < x.obj1) && x.obj2 < y.obj2); 00057 } 00058 00059 #endif