00001 /*************************************************************************** 00002 * Copyright (C) 2005-2011 LpzRobots development team * 00003 * Georg Martius <georg dot martius at web dot de> * 00004 * Frank Guettler <guettler at informatik dot uni-leipzig dot de * 00005 * Frank Hesse <frank at nld dot ds dot mpg dot de> * 00006 * Ralf Der <ralfder at mis dot mpg dot de> * 00007 * * 00008 * This program is free software; you can redistribute it and/or modify * 00009 * it under the terms of the GNU General Public License as published by * 00010 * the Free Software Foundation; either version 2 of the License, or * 00011 * (at your option) any later version. * 00012 * * 00013 * This program is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00016 * GNU General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU General Public License * 00019 * along with this program; if not, write to the * 00020 * Free Software Foundation, Inc., * 00021 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00022 * * 00023 ***************************************************************************/ 00024 #ifndef __STRAIGHTLINE_H 00025 #define __STRAIGHTLINE_H 00026 00027 #include "abstracttracksection.h" 00028 00029 /** 00030 * Abstract class (interface) for obstacles 00031 */ 00032 class StraightLine : public AbstractTrackSection { 00033 00034 public: 00035 00036 /** 00037 * Constructor 00038 */ 00039 StraightLine(const Position& p,const double& angle); 00040 00041 /** 00042 * Constructor 00043 */ 00044 StraightLine(const Matrix& pose); 00045 00046 virtual ~StraightLine(){} 00047 00048 void setCurveAngle(double alpha); 00049 00050 /** 00051 * gives the position and rotation(angle) of the segment at the 00052 * end of the segment so that a new segment could be placed there 00053 * if you want to place the new segment, you must muliplicate: 00054 * getTransformedEndMatrix()*getPositionMatrix(); 00055 */ 00056 virtual Matrix getTransformedEndMatrix(); 00057 00058 00059 /** 00060 * returns true if the real coordinates lay inside of the segment 00061 */ 00062 virtual bool isInside(const Position& p); 00063 00064 00065 virtual double getSectionIdValue(const Position& p); 00066 00067 virtual double getWidthIdValue(const Position& p); 00068 00069 00070 /** 00071 * returns the length of the segment, 00072 * here it is the length of the arc 00073 * formula is: radius * angle; 00074 */ 00075 virtual double getLength(); 00076 00077 /** 00078 * returns the width of the segment, 00079 */ 00080 virtual double getWidth(); 00081 00082 /** 00083 * sets the width of the segment, 00084 */ 00085 virtual void setWidth(double w); 00086 00087 00088 /** 00089 * draws the obstacle (4 boxes for the playground) 00090 */ 00091 virtual void draw(); 00092 00093 virtual void create(dSpaceID space); 00094 00095 virtual void destroy(); 00096 00097 protected: 00098 // this is the length of the segment 00099 double length; 00100 // this is the width of the segment 00101 // normally it should be the same like alle the other segments 00102 double width; 00103 dGeomID wallLeft; // the wall left to the street 00104 dGeomID wallRight; // the wall right to the street 00105 double widthWall; 00106 double heightWall; 00107 // angle is for straightline 0 00108 double angle; 00109 // determines if the curve goes right or left 00110 double isLeft; 00111 00112 bool obstacle_exists; 00113 00114 /** 00115 * obstacle color 00116 */ 00117 Color color; 00118 00119 void setProperties(); 00120 }; 00121 00122 #endif