@@ -138,24 +138,22 @@ void Figure2D::draw_ring(const Vector& c, const Interval& r, const StyleProperti
138
138
output_fig->draw_ring (c,r,s);
139
139
}
140
140
141
- void Figure2D::draw_line (const Vector& x , const Vector& y , const StyleProperties& s)
141
+ void Figure2D::draw_line (const Vector& a , const Vector& b , const StyleProperties& s)
142
142
{
143
- assert_release (x .size () == y .size ());
144
- assert_release (x .size () == 2 );
145
- vector<Vector> values = {x,y };
143
+ assert_release (a .size () == b .size ());
144
+ assert_release (a .size () == 2 );
145
+ vector<Vector> values = {a,b };
146
146
147
- for (const auto & output_fig : _output_figures)
148
- output_fig->draw_polyline (values,1e-3 *scaled_unit (),s);
147
+ draw_polyline (values,s);
149
148
}
150
149
151
- void Figure2D::draw_arrow (const Vector& x , const Vector& y , float tip_length, const StyleProperties& s)
150
+ void Figure2D::draw_arrow (const Vector& a , const Vector& b , float tip_length, const StyleProperties& s)
152
151
{
153
- assert_release (x .size () == y .size ());
154
- assert_release (x .size () == 2 );
155
- vector<Vector> values = {x,y };
152
+ assert_release (a .size () == b .size ());
153
+ assert_release (a .size () == 2 );
154
+ vector<Vector> values = {a,b };
156
155
157
- for (const auto & output_fig : _output_figures)
158
- output_fig->draw_polyline (values,tip_length,s);
156
+ draw_polyline (values,tip_length,s);
159
157
}
160
158
161
159
void Figure2D::draw_polyline (const vector<Vector>& x, const StyleProperties& s)
@@ -236,14 +234,13 @@ void Figure2D::draw_trajectory(const SampledTrajectory<Vector>& x, const ColorMa
236
234
{
237
235
assert_release (this ->size () <= x.size ());
238
236
239
- std::vector<Vector> values ( 2 ) ;
240
- values[ 0 ] = x. begin ()-> second ;
241
- for (auto it = std::next ( x.begin ()); it != x.end (); ++it)
237
+ double range = x. rbegin ()-> first - x. begin ()-> first ;
238
+
239
+ for (auto it = x.begin (); std::next (it) != x.end (); ++it)
242
240
{
243
- values[1 ] = it->second ;
244
- Color color = cmap.color ((it->first - x.begin ()->first ) / (x.rbegin ()->first - x.begin ()->first ));
245
- draw_polyline (values, color);
246
- values[0 ] = values[1 ];
241
+ draw_polyline (
242
+ { it->second , std::next (it)->second },
243
+ cmap.color ((it->first - x.begin ()->first ) / range));
247
244
}
248
245
}
249
246
0 commit comments