degreesegment.h

Go to the documentation of this file.
00001 /*************************************************************************** 00002 * Copyright (C) 2005 by Robot Group Leipzig * 00003 * martius@informatik.uni-leipzig.de * 00004 * fhesse@informatik.uni-leipzig.de * 00005 * der@informatik.uni-leipzig.de * 00006 * frankguettler@gmx.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 * $Log: degreesegment.h,v $ 00024 * Revision 1.7 2005/12/12 13:44:41 martius 00025 * barcodesensor is working 00026 * 00027 * Revision 1.6 2005/12/07 22:19:11 robot3 00028 * one tiny mistake fixed 00029 * 00030 * Revision 1.5 2005/12/05 12:35:00 robot3 00031 * showAABB is now configurable 00032 * 00033 * Revision 1.4 2005/12/03 16:57:12 martius 00034 * setWidth is void 00035 * 00036 * Revision 1.3 2005/11/22 15:51:23 robot3 00037 * testing 00038 * 00039 * Revision 1.2 2005/11/22 13:03:31 robot3 00040 * bugfixing 00041 * 00042 * Revision 1.1 2005/11/15 14:29:25 robot3 00043 * first version 00044 * 00045 * * 00046 ***************************************************************************/ 00047 #ifndef __DEGREESEGMENT_H 00048 #define __DEGREESEGMENT_H 00049 00050 #include "abstracttracksection.h" 00051 00052 /** 00053 * class for degree segments 00054 */ 00055 class DegreeSegment : public AbstractTrackSection { 00056 00057 public: 00058 00059 /** 00060 * Constructor 00061 */ 00062 DegreeSegment(const Position& p,const double& angle); 00063 00064 00065 /** 00066 * Constructor 00067 */ 00068 DegreeSegment(const Matrix& position); 00069 00070 virtual ~DegreeSegment(){} 00071 00072 00073 /** 00074 * returns the length of the segment, 00075 * here it is the length of the arc 00076 */ 00077 00078 virtual double getLength(); 00079 00080 /** 00081 * returns the width of the segment, 00082 */ 00083 virtual double getWidth(); 00084 00085 /** 00086 * sets the width of the segment, 00087 */ 00088 virtual void setWidth(double w); 00089 00090 00091 virtual void setCurveAngle(const double& alpha); 00092 00093 virtual void setRadius(const double& rad); 00094 00095 /** 00096 * gives the position and rotation(angle) of the segment at the 00097 * end of the segment so that a new segment could be placed there 00098 * if you want to place the new segment, you must muliplicate: 00099 * getTransformedEndMatrix()*getPositionMatrix(); 00100 */ 00101 virtual Matrix getTransformedEndMatrix(); 00102 00103 00104 /** 00105 * returns true if the real coordinates lay inside of the segment 00106 */ 00107 virtual bool isInside(const Position& p); 00108 00109 00110 /** 00111 * returns a value between 0 and 100 that tells at which section 00112 * you are on the segment. 00113 * 0 means you are on the beginning 00114 * 100 means you are at the end 00115 * returns -1 if no IdValue can be given 00116 */ 00117 virtual double getSectionIdValue(const Position& p); 00118 00119 00120 /** 00121 * returns a value between 0 and 100 that tells at which width 00122 * you are on the segment, more to right or more to the left. 00123 * 0 means you are on the left 00124 * 50 means you are in the middle 00125 * 100 means you are on the right 00126 * returns -1 if no WidthValue can be given 00127 */ 00128 virtual double getWidthIdValue(const Position& p); 00129 00130 00131 /** 00132 * draws the obstacle (4 boxes for the playground) 00133 */ 00134 virtual void draw(); 00135 00136 00137 00138 virtual void create(dSpaceID space); 00139 00140 00141 virtual void destroy(); 00142 00143 protected: 00144 // this is the radius of the curve 00145 double radius; 00146 // this is the width of the segment 00147 // normally it should be the same like alle the other segments 00148 double width; 00149 00150 bool show_aabb; 00151 00152 // the wall to be drawed 00153 list<dGeomID> innerWalls; 00154 list<dGeomID> outerWalls; 00155 00156 double widthWall; 00157 double heightWall; 00158 00159 // angle is for 90DegreeSegment is 90 00160 double angle; 00161 00162 // determines if the curve goes left or right 00163 int left; 00164 00165 bool obstacle_exists; 00166 00167 /** 00168 * obstacle color 00169 */ 00170 Color color; 00171 00172 void setProperties(); 00173 00174 /** 00175 * returns the local coordinates on the track at the given radius and angle 00176 that are responsible for the segment of the 00177 */ 00178 Position getLocalCoordinates(double radius, double alpha); 00179 00180 /** 00181 * returns the global coordinates on the track at the given radius and angle 00182 that are responsible for the segment of the 00183 */ 00184 Position getGlobalCoordinates(double radius, double alpha); 00185 00186 }; 00187 00188 #endif 00189 00190 00191

Generated on Tue Jan 16 02:14:35 2007 for Robotsystem of the Robot Group Leipzig by doxygen 1.3.8