27 std::string options=
"LineColor=0,0,0;LineWidth=0;FillColor=1,0,0",
double r=0.5)
29 const int numPoints = 16;
31 static double cosAngle[numPoints],sinAngle[numPoints];
33 if(cosAngle[1] == 0.0)
35 for(
int i = 0; i<numPoints; i++)
37 double angle = 2.0*
M_PI*i/numPoints;
38 cosAngle[i] =
cos(angle);
39 sinAngle[i] =
sin(angle);
43 double X[numPoints], Y[numPoints], Z[numPoints];
44 for(
int i = 0; i<numPoints; i++)
46 X[i] =
x+cosAngle[i]*
r;
47 Y[i] =
y+sinAngle[i]*
r;
50 figure->
patch(tag,X,Y,Z,numPoints,options);
54 std::string options=
"LineColor=1,0,0;LineWidth=1")
56 const int numPoints = 16;
58 static double cosAngle[numPoints],sinAngle[numPoints];
60 if(cosAngle[1] == 0.0)
62 for(
int i = 0; i<numPoints; i++)
64 double angle = 2.0*
M_PI*i/numPoints;
65 cosAngle[i] =
cos(angle);
66 sinAngle[i] =
sin(angle);
70 double X[numPoints+1], Y[numPoints+1], Z[numPoints+1];
71 for(
int i = 0; i<numPoints; i++)
73 X[i] =
x+cosAngle[i]*
r;
74 Y[i] =
y+sinAngle[i]*
r;
80 figure->
plot(tag,X,Y,Z,numPoints+1,options);
84 std::string options=
"LineColor=1,0,0;LineWidth=1")
92 ss << tag <<
"/n" << i;
106 double pi = 3.141592654;
108 const int numOfEdges = 4;
109 const int numPoints = 13;
110 double x_rec[numPoints];
111 double y_rec[numPoints];
112 double z_rec[numPoints];
118 double points[numPoints] = {
atan2(a/2,b),
atan2(a,b),
atan2(a,b/2),
atan2(a,-b/2),
atan2(a,-b),
atan2(a/2,-b),
atan2(-a/2,-b)+2*pi,
atan2(-a,-b)+2*pi,
atan2(-a,-b/2)+2*pi,
atan2(-a,b/2)+2*pi,
atan2(-a,b)+2*pi ,
atan2(-a/2,b)+2*pi ,
atan2(a,b)};
120 for (
int i=0; i<numPoints;i++)
123 if( (theta>=0 && theta<edges[0]) || (theta>=edges[3] && theta<2*pi ) )
126 x_rec[cc] =
r*
cos(theta+alpha);
127 y_rec[cc] =
r*
sin(theta+alpha);
128 x_rec[cc] = x_rec[cc] +
x;
129 y_rec[cc] = y_rec[cc] +
y;
133 else if( theta>= edges[0] && theta < edges[1] )
135 r= a/
cos(-pi/2+(theta));
136 x_rec[cc] =
r*
cos(theta+alpha);
137 y_rec[cc] =
r*
sin(theta+alpha);
138 x_rec[cc] = x_rec[cc] +
x;
139 y_rec[cc] = y_rec[cc] +
y;
143 else if ( theta>= edges[1] && theta < edges[2] )
145 r= b/
cos(-pi+(theta));
146 x_rec[cc] =
r*
cos(theta+alpha);
147 y_rec[cc] =
r*
sin(theta+alpha);
148 x_rec[cc] = x_rec[cc] +
x;
149 y_rec[cc] = y_rec[cc] +
y;
153 else if ( theta>= edges[2] && theta < edges[3] )
155 r= a/
cos(pi/2+(theta));
156 x_rec[cc] =
r*
cos(theta+alpha);
157 y_rec[cc] =
r*
sin(theta+alpha);
158 x_rec[cc] = x_rec[cc] +
x;
159 y_rec[cc] = y_rec[cc] +
y;
164 figure->
plot(tag,x_rec,y_rec,z_rec,numPoints,options);
171 inline void plotArrow(std::string hashtag,
double x,
double y,
double z,
double alpha,
double shaft_length,
174 double pi = 3.141592654;
175 double head_angle = pi/4.0;
178 double tail_length = head_length*0.66;
181 double x1 =
x + shaft_length * ca;
182 double y1 =
y + shaft_length * sa;
185 X[0] =
x - tail_length * sa;
186 Y[0] =
y + tail_length * ca;
188 X[1] =
x + tail_length * sa;
189 Y[1] =
y - tail_length * ca;
197 X[4] =
x1 + head_length *
std::cos(alpha + pi - head_angle);
198 Y[4] =
y1 + head_length *
std::sin(alpha + pi - head_angle);
203 X[6] =
x1 + head_length *
std::cos(alpha - pi + head_angle);
204 Y[6] =
y1 + head_length *
std::sin(alpha - pi + head_angle);
206 figure->
plot(hashtag,X,Y,
z,7,options);
220 figure->
plot(hashtag,X,Y,
z,2,options);
224 double max_length_ratio = 1.0;
225 double max_width_ratio = 0.33;
228 shaft_length =
std::min(shaft_length,length*max_length_ratio);
229 head_length =
std::min(head_length,shaft_length*max_width_ratio);
230 double front = (length-shaft_length)/2.0;
236 for(
int i=0;i<size;i++)
240 double L = std::sqrt(dX[i]*dX[i]+dY[i]*dY[i]);
241 plotArrow(s.str(),X[i],Y[i],
z0,X[i]+dX[i],Y[i]+dY[i],L,0.33*L,options,figure);
247 static const size_t n_plot = 100;
252 for (
auto & point : trajectory->
setPoints)
254 X[count] = point.x0ref.getX();
255 Y[count] = point.x0ref.getY();
257 if (count > n_plot)
break;
259 figure->
plot(name, X,Y,
z,count,options);
264 static const int n_plot = 100;
268 for(
int count=0;count<data.nc();count+=n_plot,batch++)
270 int items = (
std::min)(n_plot,(
int)data.nc()-count);
271 for(
int i=0;i<items;i++)
273 X[i] = data(1,count+i);
274 Y[i] = data(2,count+i);
276 std::stringstream sbuf1;
277 sbuf1<<name<<
"/"<<batch;
278 figure->
plot(sbuf1.str(), X,Y,
z,items,options);
283 static const int n_plot = 100;
287 for(
int count=0;count<data.nc();count+=n_plot,batch++)
289 int items = (
std::min)(n_plot,(
int)data.nc()-count);
290 for(
int i=0;i<items;i++)
292 X[i] = data(d1,count+i);
293 Y[i] = data(d2,count+i);
295 std::stringstream sbuf1;
296 sbuf1<<name<<
"/"<<batch;
297 figure->
plot(sbuf1.str(), X,Y,
z,items,options);
Definition: setpointrequest.h:35
std::vector< SetPoint > setPoints
Definition: setpointrequest.h:38
void plotVectorField(std::string hashtag, double *X, double *Y, double *dX, double *dY, double z0, int size, std::string options, DLR_TS::PlotLab::AFigureStub *figure)
Definition: plot_shape.h:234
void plotArrow(std::string hashtag, double x, double y, double z, double alpha, double shaft_length, double head_length, std::string options, DLR_TS::PlotLab::AFigureStub *figure)
Definition: plot_shape.h:171
void unPlotRectangle(std::string tag, DLR_TS::PlotLab::AFigureStub *figure)
Definition: plot_shape.h:166
void plotCircle(std::string tag, double x, double y, double z, double r, DLR_TS::PlotLab::AFigureStub *figure, std::string options="LineColor=1,0,0;LineWidth=1")
Definition: plot_shape.h:53
void plotData(std::string name, const adoreMatrix< double > &data, double z, int d1, int d2, std::string options, DLR_TS::PlotLab::AFigureStub *figure)
Definition: plot_shape.h:281
void plotRectangle(std::string tag, double x, double y, double l, double w, DLR_TS::PlotLab::AFigureStub *figure, std::string options="LineColor=0,0,0;LineWidth=0;FillColor=1,0,0", double alpha=0.0)
Definition: plot_shape.h:103
const void plotTrajectory(std::string name, const adore::fun::SetPointRequest *const trajectory, std::string options, DLR_TS::PlotLab::AFigureStub *figure, double z=0.0)
Definition: plot_shape.h:245
void plotCylinder(std::string tag, double x, double y, double z0, double z1, double r, double max_z_diff, DLR_TS::PlotLab::AFigureStub *figure, std::string options="LineColor=1,0,0;LineWidth=1")
Definition: plot_shape.h:83
void plotLine(std::string hashtag, double x0, double y0, double x1, double y1, double z, std::string options, DLR_TS::PlotLab::AFigureStub *figure)
Definition: plot_shape.h:209
void plotPath(std::string name, const adoreMatrix< double > &data, double z, std::string options, DLR_TS::PlotLab::AFigureStub *figure)
Definition: plot_shape.h:262
void plotPosition(std::string tag, double x, double y, DLR_TS::PlotLab::AFigureStub *figure, std::string options="LineColor=0,0,0;LineWidth=0;FillColor=1,0,0", double r=0.5)
Definition: plot_shape.h:26
interval< T > atan2(interval< T > y, interval< T > x)
Definition: intervalarithmetic.h:234
interval< T > cos(interval< T > x)
Definition: intervalarithmetic.h:225
T min(T a, T b, T c, T d)
Definition: adoremath.h:663
interval< T > sin(interval< T > x)
Definition: intervalarithmetic.h:204
x0
Definition: adore_set_goal.py:25
x
Definition: adore_set_goal.py:30
y0
Definition: adore_set_goal.py:26
z0
Definition: adore_set_goal.py:27
y
Definition: adore_set_goal.py:31
z
Definition: adore_set_goal.py:32
y1
Definition: adore_set_pose.py:29
x1
Definition: adore_set_pose.py:28
z1
Definition: adore_set_pose.py:30
w
Definition: adore_set_pose.py:40
r
Definition: adore_suppress_lanechanges.py:209
Definition: areaofeffectconverter.h:20