Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
degreesegment.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2011 LpzRobots development team *
3  * Georg Martius <georg dot martius at web dot de> *
4  * Frank Guettler <guettler at informatik dot uni-leipzig dot de *
5  * Frank Hesse <frank at nld dot ds dot mpg dot de> *
6  * Ralf Der <ralfder at mis dot mpg dot de> *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the *
20  * Free Software Foundation, Inc., *
21  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22  * *
23  ***************************************************************************/
24 #ifndef __DEGREESEGMENT_H
25 #define __DEGREESEGMENT_H
26 
27 #include "abstracttracksection.h"
28 
29 /**
30  * class for degree segments
31  */
33 
34  public:
35 
36  /**
37  * Constructor
38  */
39  DegreeSegment(const Position& p,const double& angle);
40 
41 
42  /**
43  * Constructor
44  */
45  DegreeSegment(const Matrix& position);
46 
47  virtual ~DegreeSegment(){}
48 
49 
50 /**
51  * returns the length of the segment,
52  * here it is the length of the arc
53  */
54 
55 virtual double getLength();
56 
57 /**
58  * returns the width of the segment,
59  */
60  virtual double getWidth();
61 
62 /**
63  * sets the width of the segment,
64  */
65  virtual void setWidth(double w);
66 
67 
68 virtual void setCurveAngle(const double& alpha);
69 
70 virtual void setRadius(const double& rad);
71 
72  /**
73  * gives the position and rotation(angle) of the segment at the
74  * end of the segment so that a new segment could be placed there
75  * if you want to place the new segment, you must muliplicate:
76  * getTransformedEndMatrix()*getPositionMatrix();
77  */
79 
80 
81 /**
82  * returns true if the real coordinates lay inside of the segment
83  */
84 virtual bool isInside(const Position& p);
85 
86 
87 /**
88  * returns a value between 0 and 100 that tells at which section
89  * you are on the segment.
90  * 0 means you are on the beginning
91  * 100 means you are at the end
92  * returns -1 if no IdValue can be given
93  */
94 virtual double getSectionIdValue(const Position& p);
95 
96 
97 /**
98  * returns a value between 0 and 100 that tells at which width
99  * you are on the segment, more to right or more to the left.
100  * 0 means you are on the left
101  * 50 means you are in the middle
102  * 100 means you are on the right
103  * returns -1 if no WidthValue can be given
104  */
105 virtual double getWidthIdValue(const Position& p);
106 
107 
108 /**
109  * draws the obstacle (4 boxes for the playground)
110  */
111  virtual void draw();
112 
113 
114 
115 virtual void create(dSpaceID space);
116 
117 
118 virtual void destroy();
119 
120  protected:
121  // this is the radius of the curve
122  double radius;
123  // this is the width of the segment
124  // normally it should be the same like alle the other segments
125  double width;
126 
127  bool show_aabb;
128 
129  // the wall to be drawed
130  list<dGeomID> innerWalls;
131  list<dGeomID> outerWalls;
132 
133  double widthWall;
134  double heightWall;
135 
136  // angle is for 90DegreeSegment is 90
137  double angle;
138 
139  // determines if the curve goes left or right
140  int left;
141 
143 
144  /**
145  * obstacle color
146  */
147  Color color;
148 
149  void setProperties();
150 
151  /**
152  * returns the local coordinates on the track at the given radius and angle
153  that are responsible for the segment of the
154  */
155  Position getLocalCoordinates(double radius, double alpha);
156 
157  /**
158  * returns the global coordinates on the track at the given radius and angle
159  that are responsible for the segment of the
160  */
161  Position getGlobalCoordinates(double radius, double alpha);
162 
163 };
164 
165 #endif
166 
167 
168 
Matrix type.
Definition: matrix.h:65
int left
Definition: degreesegment.h:140
Abstract class (interface) for obstacles.
Definition: abstracttracksection.h:37
double radius
Definition: degreesegment.h:122
virtual void create(dSpaceID space)
Definition: degreesegment.cpp:285
double width
Definition: degreesegment.h:125
void setProperties()
Definition: degreesegment.cpp:45
virtual ~DegreeSegment()
Definition: degreesegment.h:47
DegreeSegment(const Position &p, const double &angle)
Constructor.
Definition: degreesegment.cpp:31
virtual void destroy()
Definition: degreesegment.cpp:357
virtual double getLength()
returns the length of the segment, here it is the length of the arc
Definition: degreesegment.cpp:261
double heightWall
Definition: degreesegment.h:134
virtual Matrix getTransformedEndMatrix()
gives the position and rotation(angle) of the segment at the end of the segment so that a new segment...
Definition: degreesegment.cpp:98
Definition: position.h:30
class for degree segments
Definition: degreesegment.h:32
double angle
Definition: degreesegment.h:137
virtual bool isInside(const Position &p)
returns true if the real coordinates lay inside of the segment
Definition: degreesegment.cpp:127
double widthWall
Definition: degreesegment.h:133
bool obstacle_exists
Definition: degreesegment.h:142
Position getGlobalCoordinates(double radius, double alpha)
returns the global coordinates on the track at the given radius and angle that are responsible for th...
Definition: degreesegment.cpp:89
virtual double getSectionIdValue(const Position &p)
returns a value between 0 and 100 that tells at which section you are on the segment.
Definition: degreesegment.cpp:137
virtual void setRadius(const double &rad)
Definition: degreesegment.cpp:64
virtual void setCurveAngle(const double &alpha)
Definition: degreesegment.cpp:56
Position getLocalCoordinates(double radius, double alpha)
returns the local coordinates on the track at the given radius and angle that are responsible for the...
Definition: degreesegment.cpp:68
list< dGeomID > innerWalls
Definition: degreesegment.h:130
virtual double getWidth()
returns the width of the segment,
Definition: degreesegment.cpp:271
Color color
obstacle color
Definition: degreesegment.h:147
virtual void draw()
draws the obstacle (4 boxes for the playground)
Definition: degreesegment.cpp:207
bool show_aabb
Definition: degreesegment.h:127
list< dGeomID > outerWalls
Definition: degreesegment.h:131
virtual double getWidthIdValue(const Position &p)
returns a value between 0 and 100 that tells at which width you are on the segment, more to right or more to the left.
Definition: degreesegment.cpp:163
virtual void setWidth(double w)
sets the width of the segment,
Definition: degreesegment.cpp:278