codac 2.0.0
Loading...
Searching...
No Matches
codac2_Figure2D.h
Go to the documentation of this file.
1
9
10#pragma once
11
12#include <string>
13#include <vector>
14#include <memory>
15#include <functional>
16#include <utility>
17#include "codac2_Index.h"
21#include "codac2_SampledTraj.h"
22#include "codac2_AnalyticTraj.h"
23#include "codac2_Paving.h"
25#include "codac2_Zonotope.h"
26#include "codac2_PavingStyle.h"
27#include "codac2_Ellipsoid.h"
28#include "codac2_Polygon.h"
29#include "codac2_SlicedTube.h"
30#include "codac2_Ctc.h"
31#include "codac2_Sep.h"
32
33#define DEFAULT_FIG_NAME "Codac - default figure"
34
35namespace codac2
36{
37 enum class GraphicOutput
38 {
39 VIBES = 0x01,
40 IPE = 0x02
41 };
42
43 constexpr int operator&(GraphicOutput a, GraphicOutput b)
44 { return static_cast<int>(static_cast<int>(a) & static_cast<int>(b)); }
45
46 constexpr GraphicOutput operator|(GraphicOutput a, GraphicOutput b)
47 { return static_cast<GraphicOutput>(static_cast<int>(a) | static_cast<int>(b)); }
48
49 struct FigureAxis
50 {
51 Index dim_id;
52 Interval limits;
53 std::string label;
54 };
55
56 inline FigureAxis axis(Index dim_id, const Interval& limits, const std::string& label = "")
57 {
58 assert_release(dim_id >= 0);
59 //assert_release(!limits.is_empty());
60
61 std::string axis_label = label;
62 if(axis_label.empty())
63 axis_label = "x_" + std::to_string(dim_id);
64
65 return { dim_id, limits, axis_label };
66 }
67
68 class DefaultFigure;
69 class PavingOut;
70 class PavingInOut;
71 template<typename P>
72 class Subpaving;
73
86 class Figure2D : public std::enable_shared_from_this<Figure2D>
87 {
88 public:
89
96 Figure2D(const std::string& name, GraphicOutput o);
97
103 std::vector<std::shared_ptr<OutputFigure2D>> output_figures();
104
110 const std::string& name() const;
111
117 Index size() const;
118
124 const std::vector<FigureAxis>& axes() const;
125
132 Figure2D& set_axes(const FigureAxis& axis1, const FigureAxis& axis2);
133
140
146 const Index& i() const;
147
153 const Index& j() const;
154
160 const Vector& pos() const;
161
167 const Vector& window_size() const;
168
176
186 void center_viewbox(const Vector& c, const Vector& r);
187
191 void clear();
192
198 void save(const std::string& filename);
199
205 double scaled_unit() const;
206
211
217 bool is_default() const;
218
223
229 void set_tdomain(const Interval& tdomain);
230
247 std::function<Vector(const Vector&)> projection,
248 std::function<IntervalVector(const IntervalVector&)> interval_projection = {});
249
250 // Geometric shapes
251
258 void draw_point(const Vector& c, const StyleProperties& style = StyleProperties());
259
266 void draw_box(const IntervalVector& x, const StyleProperties& style = StyleProperties());
267
275 void draw_circle(const Vector& c, double r, const StyleProperties& style = StyleProperties());
276
284 void draw_ring(const Vector& c, const Interval& r, const StyleProperties& style = StyleProperties());
285
293 void draw_line(const Vector& p1, const Vector& p2, const StyleProperties& style = StyleProperties());
294
301 void draw_line(const Segment& e, const StyleProperties& style = StyleProperties());
302
311 void draw_arrow(const Vector& p1, const Vector& p2, float tip_length, const StyleProperties& style = StyleProperties());
312
319 void draw_polyline(const std::vector<Vector>& x, const StyleProperties& style = StyleProperties());
320
328 void draw_polyline(const std::vector<Vector>& x, float tip_length, const StyleProperties& style = StyleProperties());
329
336 void draw_polygon(const Polygon& x, const StyleProperties& style = StyleProperties());
337
345
352 void draw_zonotope(const Zonotope& z, const StyleProperties& style = StyleProperties());
353
362 void draw_pie(const Vector& c, const Interval& r, const Interval& theta, const StyleProperties& style = StyleProperties());
363
372 void draw_ellipse(const Vector& c, const Vector& ab, double theta, const StyleProperties& style = StyleProperties());
373
380 void draw_ellipsoid(const Ellipsoid& e, const StyleProperties& style = StyleProperties());
381
388 void draw_trajectory(const SampledTraj<Vector>& x, const StyleProperties& style = StyleProperties());
389
396 void draw_trajectory(const AnalyticTraj<VectorType>& x, const StyleProperties& style = StyleProperties());
397
404 void draw_trajectory(const SampledTraj<Vector>& x, const StyleGradientProperties& style);
405
412 void draw_trajectory(const AnalyticTraj<VectorType>& x, const StyleGradientProperties& style);
413
420 void plot_trajectory(const SampledTraj<double>& x, const StyleProperties& style = StyleProperties());
421
428 void plot_trajectory(const AnalyticTraj<ScalarType>& x, const StyleProperties& style = StyleProperties());
429
435 void plot_trajectories(const SampledTraj<Vector>& x);
436
443 void plot_trajectories(const SampledTraj<Vector>& x, const StyleProperties& style);
444
458 void draw_tube(const SlicedTube<IntervalVector>& x, const StyleProperties& style, int max_nb_slices_to_display = 5000);
459
473 void draw_tube(const SlicedTube<IntervalVector>& x, const StyleGradientProperties& style = StyleGradientProperties(ColorMap::blue_tube(), "z:-1"), int max_nb_slices_to_display = 5000);
474
482
492
493 // Robots
494
502 void draw_tank(const Vector& x, float size, const StyleProperties& style = StyleProperties());
503
511 void draw_AUV(const Vector& x, float size, const StyleProperties& style = StyleProperties());
512
520 void draw_motor_boat(const Vector& x, float size, const StyleProperties& style = StyleProperties());
521
522 // Miscellaneous
523
532 void draw_text(const std::string& text, const Vector& ul, double scale, const StyleProperties& style = StyleProperties());
533
541 void draw_raster(const std::string& filename, const IntervalVector& bbox, const StyleProperties& style = StyleProperties());
542
543 // Pavings
544
551 void draw_paving(const PavingOut& p,
552 const PavingStyle& style = PavingStyle::default_style());
553
561 void draw_paving(const PavingOut& p,
562 const std::function<void(Figure2D&,const IntervalVector&,const StyleProperties&)>& draw_box,
563 const PavingStyle& style = PavingStyle::default_style());
564
571 void draw_paving(const PavingInOut& p,
572 const PavingStyle& style = PavingStyle::default_style());
573
581 void draw_paving(const PavingInOut& p,
582 const std::function<void(Figure2D&,const IntervalVector&,const StyleProperties&)>& draw_box,
583 const PavingStyle& style = PavingStyle::default_style());
584
593 template<typename C>
594 requires IsCtcBaseOrPtr<C,IntervalVector>
595 void pave(const IntervalVector& x0, const C& c, double eps,
596 const PavingStyle& style = PavingStyle::default_style());
597
607 template<typename C>
608 requires IsCtcBaseOrPtr<C,IntervalVector>
609 void pave(const IntervalVector& x0, const C& c, double eps,
610 const std::function<void(Figure2D&,const IntervalVector&,const StyleProperties&)>& draw_box,
611 const PavingStyle& style = PavingStyle::default_style());
612
621 template<typename S>
622 requires IsSepBaseOrPtr<S>
623 void pave(const IntervalVector& x0, const S& s, double eps,
624 const PavingStyle& style = PavingStyle::default_style());
625
635 template<typename S>
636 requires IsSepBaseOrPtr<S>
637 void pave(const IntervalVector& x0, const S& s, double eps,
638 const std::function<void(Figure2D&,const IntervalVector&,const StyleProperties&)>& draw_box,
639 const PavingStyle& style = PavingStyle::default_style());
640
647 template<typename P>
648 void draw_subpaving(const Subpaving<P>& p, const StyleProperties& style = StyleProperties())
649 {
650 for(const auto& pi : p.boxes())
651 draw_box(pi, style);
652 }
653
654 protected:
655
656 const std::string _name;
657 Vector _pos {50,50}, _window_size {700,700};
658 std::vector<FigureAxis> _axes { axis(0,{0,1}), axis(1,{0,1}) };
659 std::vector<FigureAxis> _source_axes { axis(0,{0,1}), axis(1,{0,1}) };
660 void update_projected_axes();
661 Vector project_position(const Vector& x) const;
662 std::vector<std::shared_ptr<OutputFigure2D>> _output_figures;
663 std::function<Vector(const Vector&)> _projection;
664 std::function<IntervalVector(const IntervalVector&)> _interval_projection;
665 Interval _tdomain;
666
667 friend DefaultFigure;
668 };
669
679 {
680 public:
681
687 static std::shared_ptr<Figure2D> selected_fig()
688 {
689 if(_selected_fig == nullptr)
690 _selected_fig = _default_fig;
691 return _selected_fig;
692 }
693
699 static void set(std::shared_ptr<Figure2D> fig)
700 {
701 _selected_fig = fig;
702 }
703
710 static Figure2D& set_axes(const FigureAxis& axis1, const FigureAxis& axis2)
711 {
712 auto_init();
713 return selected_fig()->set_axes(axis1,axis2);
714 }
715
721 static Figure2D& set_axes(const IntervalVector& bbox)
722 {
723 auto_init();
724 return selected_fig()->set_axes(bbox);
725 }
726
733 static void set_window_properties(const Vector& pos, const Vector& size)
734 {
735 auto_init();
736 selected_fig()->set_window_properties(pos,size);
737 }
738
742 static void auto_scale()
743 {
744 auto_init();
745 selected_fig()->auto_scale();
746 }
747
751 static void clear()
752 {
753 auto_init();
754 selected_fig()->clear();
755 }
756
762 static void save(const std::string& filename)
763 {
764 auto_init();
765 selected_fig()->save(filename);
766 }
767
774 static Figure2D& set_projection(
775 std::function<Vector(const Vector&)> projection,
776 std::function<IntervalVector(const IntervalVector&)> interval_projection = {})
777 {
778 auto_init();
779 return selected_fig()->set_projection(std::move(projection),std::move(interval_projection));
780 }
781
782 // Geometric shapes
783
790 static void draw_point(const Vector& c, const StyleProperties& style = StyleProperties())
791 {
792 auto_init();
793 selected_fig()->draw_point(c,style);
794 }
795
802 static void draw_box(const IntervalVector& x, const StyleProperties& style = StyleProperties())
803 {
804 auto_init();
805 selected_fig()->draw_box(x,style);
806 }
807
815 static void draw_circle(const Vector& c, double r, const StyleProperties& style = StyleProperties())
816 {
817 auto_init();
818 selected_fig()->draw_circle(c,r,style);
819 }
820
828 static void draw_ring(const Vector& c, const Interval& r, const StyleProperties& style = StyleProperties())
829 {
830 auto_init();
831 selected_fig()->draw_ring(c,r,style);
832 }
833
841 static void draw_line(const Vector& p1, const Vector& p2, const StyleProperties& style = StyleProperties())
842 {
843 auto_init();
844 selected_fig()->draw_line(p1,p2,style);
845 }
846
853 static void draw_line(const Segment& e, const StyleProperties& style = StyleProperties())
854 {
855 auto_init();
856 selected_fig()->draw_line(e,style);
857 }
858
867 static void draw_arrow(const Vector& p1, const Vector& p2, float tip_length, const StyleProperties& style = StyleProperties())
868 {
869 auto_init();
870 selected_fig()->draw_arrow(p1,p2,tip_length,style);
871 }
872
879 static void draw_polyline(const std::vector<Vector>& x, const StyleProperties& style = StyleProperties())
880 {
881 auto_init();
882 selected_fig()->draw_polyline(x,style);
883 }
884
892 static void draw_polyline(const std::vector<Vector>& x, float tip_length, const StyleProperties& style = StyleProperties())
893 {
894 auto_init();
895 selected_fig()->draw_polyline(x,tip_length,style);
896 }
897
904 static void draw_polygon(const Polygon& x, const StyleProperties& style = StyleProperties())
905 {
906 auto_init();
907 selected_fig()->draw_polygon(x,style);
908 }
909
917 {
918 auto_init();
919 selected_fig()->draw_parallelepiped(p,style);
920 }
921
928 static void draw_zonotope(const Zonotope& c, const StyleProperties& style = StyleProperties())
929 {
930 auto_init();
931 selected_fig()->draw_zonotope(c,style);
932 }
933
942 static void draw_pie(const Vector& c, const Interval& r, const Interval& theta, const StyleProperties& style = StyleProperties())
943 {
944 auto_init();
945 selected_fig()->draw_pie(c,r,theta,style);
946 }
947
956 static void draw_ellipse(const Vector& c, const Vector& ab, double theta, const StyleProperties& style = StyleProperties())
957 {
958 auto_init();
959 selected_fig()->draw_ellipse(c,ab,theta,style);
960 }
961
968 static void draw_ellipsoid(const Ellipsoid& e, const StyleProperties& style = StyleProperties())
969 {
970 auto_init();
971 selected_fig()->draw_ellipsoid(e,style);
972 }
973
980 static void draw_trajectory(const SampledTraj<Vector>& x, const StyleProperties& style = StyleProperties())
981 {
982 auto_init();
983 selected_fig()->draw_trajectory(x,style);
984 }
985
992 static void draw_trajectory(const AnalyticTraj<VectorType>& x, const StyleProperties& style = StyleProperties())
993 {
994 auto_init();
995 selected_fig()->draw_trajectory(x,style);
996 }
997
1004 static void draw_trajectory(const SampledTraj<Vector>& x, const StyleGradientProperties& style)
1005 {
1006 auto_init();
1007 selected_fig()->draw_trajectory(x,style);
1008 }
1009
1016 static void draw_trajectory(const AnalyticTraj<VectorType>& x, const StyleGradientProperties& style)
1017 {
1018 auto_init();
1019 selected_fig()->draw_trajectory(x,style);
1020 }
1021
1028 static void plot_trajectory(const SampledTraj<double>& x, const StyleProperties& style = StyleProperties())
1029 {
1030 auto_init();
1031 selected_fig()->plot_trajectory(x,style);
1032 }
1033
1040 static void plot_trajectory(const AnalyticTraj<ScalarType>& x, const StyleProperties& style = StyleProperties())
1041 {
1042 auto_init();
1043 selected_fig()->plot_trajectory(x,style);
1044 }
1045
1052 static void plot_trajectories(const SampledTraj<Vector>& x, const StyleProperties& style = StyleProperties())
1053 {
1054 auto_init();
1055 selected_fig()->plot_trajectories(x,style);
1056 }
1057
1064 static void draw_tube(const SlicedTube<IntervalVector>& x, const StyleProperties& style)
1065 {
1066 auto_init();
1067 selected_fig()->draw_tube(x,style);
1068 }
1069
1077 {
1078 auto_init();
1079 selected_fig()->draw_tube(x,style);
1080 }
1081
1088 static void plot_tube(const SlicedTube<Interval>& x, const StyleProperties& style = StyleProperties())
1089 {
1090 auto_init();
1091 selected_fig()->plot_tube(x,style);
1092 }
1093
1103 {
1104 auto_init();
1105 selected_fig()->plot_tube(x,v,style);
1106 }
1107
1108 // Robots
1109
1117 static void draw_tank(const Vector& x, float size, const StyleProperties& style = StyleProperties())
1118 {
1119 auto_init();
1120 selected_fig()->draw_tank(x,size,style);
1121 }
1122
1130 static void draw_AUV(const Vector& x, float size, const StyleProperties& style = StyleProperties())
1131 {
1132 auto_init();
1133 selected_fig()->draw_AUV(x,size,style);
1134 }
1135
1143 static void draw_motor_boat(const Vector& x, float size, const StyleProperties& style = StyleProperties())
1144 {
1145 auto_init();
1146 selected_fig()->draw_motor_boat(x,size,style);
1147 }
1148
1149 // Miscellaneous
1150
1159 static void draw_text(const std::string& text, const Vector& ul, double scale, const StyleProperties& style = StyleProperties())
1160 {
1161 auto_init();
1162 selected_fig()->draw_text(text,ul,scale,style);
1163 }
1164
1172 static void draw_raster(const std::string& filename, const IntervalVector& bbox, const StyleProperties& style = StyleProperties())
1173 {
1174 auto_init();
1175 selected_fig()->draw_raster(filename,bbox,style);
1176 }
1177
1178 // Pavings
1179
1180 protected:
1181
1182 static void init_axes_paving(const IntervalVector& x)
1183 {
1184 _default_fig->set_window_properties({100,100}, {800,800});
1185 _default_fig->set_axes(axis(0,x[0],"x_1"), axis(1,x[1],"x_2"));
1186 _default_fig->auto_scale();
1187 }
1188
1189 public:
1190
1197 static void draw_paving(const PavingOut& p,
1198 const PavingStyle& style = PavingStyle::default_style())
1199 {
1200 if(auto_init())
1201 init_axes_paving(p.tree()->hull());
1202 selected_fig()->draw_paving(p, style);
1203 }
1204
1212 static void draw_paving(const PavingOut& p,
1213 const std::function<void(Figure2D&,const IntervalVector&,const StyleProperties&)>& draw_box,
1214 const PavingStyle& style = PavingStyle::default_style())
1215 {
1216 if(auto_init())
1217 init_axes_paving(p.tree()->hull());
1218 selected_fig()->draw_paving(p, draw_box, style);
1219 }
1220
1227 static void draw_paving(const PavingInOut& p,
1228 const PavingStyle& style = PavingStyle::default_style())
1229 {
1230 if(auto_init())
1231 init_axes_paving(p.tree()->hull());
1232 selected_fig()->draw_paving(p, style);
1233 }
1234
1242 static void draw_paving(const PavingInOut& p,
1243 const std::function<void(Figure2D&,const IntervalVector&,const StyleProperties&)>& draw_box,
1244 const PavingStyle& style = PavingStyle::default_style())
1245 {
1246 if(auto_init())
1247 init_axes_paving(p.tree()->hull());
1248 selected_fig()->draw_paving(p, draw_box, style);
1249 }
1250
1259 template<typename C>
1260 requires IsCtcBaseOrPtr<C,IntervalVector>
1261 static void pave(const IntervalVector& x0, const C& c, double eps,
1262 const PavingStyle& style = PavingStyle::default_style())
1263 {
1264 if(auto_init())
1265 init_axes_paving(x0);
1266 selected_fig()->pave(x0, c, eps, style);
1267 }
1268
1278 template<typename C>
1279 requires IsCtcBaseOrPtr<C,IntervalVector>
1280 static void pave(const IntervalVector& x0, const C& c, double eps,
1281 const std::function<void(Figure2D&,const IntervalVector&,const StyleProperties&)>& draw_box,
1282 const PavingStyle& style = PavingStyle::default_style())
1283 {
1284 if(auto_init())
1285 init_axes_paving(x0);
1286 selected_fig()->pave(x0, c, eps, draw_box, style);
1287 }
1288
1297 template<typename S>
1298 requires IsSepBaseOrPtr<S>
1299 static void pave(const IntervalVector& x0, const S& s, double eps,
1300 const PavingStyle& style = PavingStyle::default_style())
1301 {
1302 if(auto_init())
1303 init_axes_paving(x0);
1304 selected_fig()->pave(x0, s, eps, style);
1305 }
1306
1316 template<typename S>
1317 requires IsSepBaseOrPtr<S>
1318 static void pave(const IntervalVector& x0, const S& s, double eps,
1319 const std::function<void(Figure2D&,const IntervalVector&,const StyleProperties&)>& draw_box,
1320 const PavingStyle& style = PavingStyle::default_style())
1321 {
1322 if(auto_init())
1323 init_axes_paving(x0);
1324 selected_fig()->pave(x0, s, eps, draw_box, style);
1325 }
1326
1333 template<typename P>
1334 static void draw_subpaving(const Subpaving<P>& p, const StyleProperties& style = StyleProperties())
1335 {
1336 auto_init();
1337 selected_fig()->draw_subpaving(p, style);
1338 }
1339
1340
1341 protected:
1342
1343 static bool auto_init()
1344 {
1345 if(!_default_fig && !_selected_fig)
1346 {
1347 _default_fig = std::make_shared<Figure2D>(DEFAULT_FIG_NAME, GraphicOutput::VIBES);
1348 _default_fig->set_window_properties({20.,20.}, {800.,800.});
1349 _default_fig->set_axes(axis(0,{-10,10}),axis(1,{-10,10}));
1350 _selected_fig = _default_fig;
1351 return true;
1352 }
1353
1354 return false;
1355 }
1356
1357 friend Figure2D;
1358
1359 static std::shared_ptr<Figure2D> _default_fig;
1360 static std::shared_ptr<Figure2D> _selected_fig;
1361 };
1362}
1363
1364#include "codac2_Figure2D_pave.h"
Default view class, used to manage the default figure.
Definition codac2_Figure2D.h:679
static void draw_trajectory(const SampledTraj< Vector > &x, const StyleProperties &style=StyleProperties())
Draws a trajectory on the figure.
Definition codac2_Figure2D.h:980
static void draw_box(const IntervalVector &x, const StyleProperties &style=StyleProperties())
Draws a box on the figure.
Definition codac2_Figure2D.h:802
static void draw_ring(const Vector &c, const Interval &r, const StyleProperties &style=StyleProperties())
Draws a ring on the figure.
Definition codac2_Figure2D.h:828
static void draw_line(const Segment &e, const StyleProperties &style=StyleProperties())
Draws a line on the figure.
Definition codac2_Figure2D.h:853
static void draw_paving(const PavingInOut &p, const std::function< void(Figure2D &, const IntervalVector &, const StyleProperties &)> &draw_box, const PavingStyle &style=PavingStyle::default_style())
Draws a previously computed paving (inner/outer approximation) on the figure.
Definition codac2_Figure2D.h:1242
static void draw_circle(const Vector &c, double r, const StyleProperties &style=StyleProperties())
Draws a circle on the figure.
Definition codac2_Figure2D.h:815
static void draw_AUV(const Vector &x, float size, const StyleProperties &style=StyleProperties())
Draws an AUV on the figure.
Definition codac2_Figure2D.h:1130
static void draw_polygon(const Polygon &x, const StyleProperties &style=StyleProperties())
Draws a Polygon object on the figure.
Definition codac2_Figure2D.h:904
static void draw_ellipsoid(const Ellipsoid &e, const StyleProperties &style=StyleProperties())
Draws an ellipsoid on the figure.
Definition codac2_Figure2D.h:968
static void draw_point(const Vector &c, const StyleProperties &style=StyleProperties())
Draws a point on the figure.
Definition codac2_Figure2D.h:790
static void plot_tube(const SlicedTube< Interval > &x, const SlicedTube< Interval > &v, const StyleProperties &style=StyleProperties())
Plots a tube on the figure (x-axis is the time), with derivative information: slices are displayed as...
Definition codac2_Figure2D.h:1102
static void draw_motor_boat(const Vector &x, float size, const StyleProperties &style=StyleProperties())
Draws a motor boat on the figure.
Definition codac2_Figure2D.h:1143
static void auto_scale()
VIBes only: auto scale the figure.
Definition codac2_Figure2D.h:742
static void draw_polyline(const std::vector< Vector > &x, float tip_length, const StyleProperties &style=StyleProperties())
Draws a polyline on the figure.
Definition codac2_Figure2D.h:892
static void pave(const IntervalVector &x0, const S &s, double eps, const PavingStyle &style=PavingStyle::default_style())
Draws a paving from a separator while it is being computed.
Definition codac2_Figure2D.h:1299
static void draw_raster(const std::string &filename, const IntervalVector &bbox, const StyleProperties &style=StyleProperties())
Draws a raster on the figure in VIBes only, only the bounding box is drawn in IPE.
Definition codac2_Figure2D.h:1172
static void draw_paving(const PavingOut &p, const std::function< void(Figure2D &, const IntervalVector &, const StyleProperties &)> &draw_box, const PavingStyle &style=PavingStyle::default_style())
Draws a previously computed paving (outer approximation) on the figure.
Definition codac2_Figure2D.h:1212
static void set(std::shared_ptr< Figure2D > fig)
Setter for the default figure.
Definition codac2_Figure2D.h:699
static void clear()
Clear the figure.
Definition codac2_Figure2D.h:751
static void draw_parallelepiped(const Parallelepiped &p, const StyleProperties &style=StyleProperties())
Draws a parallelepiped z+A*[-1,1]^2 on the figure.
Definition codac2_Figure2D.h:916
static void plot_trajectory(const SampledTraj< double > &x, const StyleProperties &style=StyleProperties())
Plots a trajectory on the figure (x-axis is the time).
Definition codac2_Figure2D.h:1028
static void draw_tube(const SlicedTube< IntervalVector > &x, const StyleProperties &style)
Draws a tube of IntervalVector on the figure.
Definition codac2_Figure2D.h:1064
static void draw_arrow(const Vector &p1, const Vector &p2, float tip_length, const StyleProperties &style=StyleProperties())
Draws an arrow on the figure.
Definition codac2_Figure2D.h:867
static void draw_paving(const PavingInOut &p, const PavingStyle &style=PavingStyle::default_style())
Draws a previously computed paving (inner/outer approximation) on the figure.
Definition codac2_Figure2D.h:1227
static void draw_zonotope(const Zonotope &c, const StyleProperties &style=StyleProperties())
Draws a zonotope c+sum_i [-1,1] A_i on the figure.
Definition codac2_Figure2D.h:928
static Figure2D & set_projection(std::function< Vector(const Vector &)> projection, std::function< IntervalVector(const IntervalVector &)> interval_projection={})
Sets an optional coordinate projection on the selected figure.
Definition codac2_Figure2D.h:774
static void plot_tube(const SlicedTube< Interval > &x, const StyleProperties &style=StyleProperties())
Plots a tube on the figure (x-axis is the time).
Definition codac2_Figure2D.h:1088
static void draw_subpaving(const Subpaving< P > &p, const StyleProperties &style=StyleProperties())
Draws a subpaving on the figure.
Definition codac2_Figure2D.h:1334
static Figure2D & set_axes(const FigureAxis &axis1, const FigureAxis &axis2)
Setter for the axes of the figure.
Definition codac2_Figure2D.h:710
static void draw_tube(const SlicedTube< IntervalVector > &x, const StyleGradientProperties &style=StyleGradientProperties(ColorMap::blue_tube(), "z:-1"))
Draws a tube of IntervalVector on the figure with a colormap.
Definition codac2_Figure2D.h:1076
static void draw_line(const Vector &p1, const Vector &p2, const StyleProperties &style=StyleProperties())
Draws a line on the figure.
Definition codac2_Figure2D.h:841
static void draw_trajectory(const AnalyticTraj< VectorType > &x, const StyleGradientProperties &style)
Draws a trajectory on the figure with a colormap.
Definition codac2_Figure2D.h:1016
static void set_window_properties(const Vector &pos, const Vector &size)
Setter for the position and size of the window.
Definition codac2_Figure2D.h:733
static void draw_pie(const Vector &c, const Interval &r, const Interval &theta, const StyleProperties &style=StyleProperties())
Draws a pie on the figure.
Definition codac2_Figure2D.h:942
static void plot_trajectories(const SampledTraj< Vector > &x, const StyleProperties &style=StyleProperties())
Plots a set of trajectories on the figure (x-axis is the time).
Definition codac2_Figure2D.h:1052
static void draw_trajectory(const SampledTraj< Vector > &x, const StyleGradientProperties &style)
Draws a trajectory on the figure with a colormap.
Definition codac2_Figure2D.h:1004
static void draw_ellipse(const Vector &c, const Vector &ab, double theta, const StyleProperties &style=StyleProperties())
Draws an ellipse on the figure.
Definition codac2_Figure2D.h:956
static void pave(const IntervalVector &x0, const C &c, double eps, const PavingStyle &style=PavingStyle::default_style())
Draws a paving from a contractor while it is being computed.
Definition codac2_Figure2D.h:1261
static Figure2D & set_axes(const IntervalVector &bbox)
Setter for the axes of the figure.
Definition codac2_Figure2D.h:721
static std::shared_ptr< Figure2D > selected_fig()
Getter for the default figure.
Definition codac2_Figure2D.h:687
static void pave(const IntervalVector &x0, const C &c, double eps, const std::function< void(Figure2D &, const IntervalVector &, const StyleProperties &)> &draw_box, const PavingStyle &style=PavingStyle::default_style())
Draws a paving from a contractor while it is being computed.
Definition codac2_Figure2D.h:1280
static void pave(const IntervalVector &x0, const S &s, double eps, const std::function< void(Figure2D &, const IntervalVector &, const StyleProperties &)> &draw_box, const PavingStyle &style=PavingStyle::default_style())
Draws a paving from a separator while it is being computed.
Definition codac2_Figure2D.h:1318
static void plot_trajectory(const AnalyticTraj< ScalarType > &x, const StyleProperties &style=StyleProperties())
Plots a trajectory on the figure (x-axis is the time).
Definition codac2_Figure2D.h:1040
static void draw_trajectory(const AnalyticTraj< VectorType > &x, const StyleProperties &style=StyleProperties())
Draws a trajectory on the figure.
Definition codac2_Figure2D.h:992
static void save(const std::string &filename)
Saves the figure to a file.
Definition codac2_Figure2D.h:762
static void draw_paving(const PavingOut &p, const PavingStyle &style=PavingStyle::default_style())
Draws a previously computed paving (outer approximation) on the figure.
Definition codac2_Figure2D.h:1197
static void draw_text(const std::string &text, const Vector &ul, double scale, const StyleProperties &style=StyleProperties())
Draws text on the figure.
Definition codac2_Figure2D.h:1159
static void draw_polyline(const std::vector< Vector > &x, const StyleProperties &style=StyleProperties())
Draws a polyline on the figure.
Definition codac2_Figure2D.h:879
static void draw_tank(const Vector &x, float size, const StyleProperties &style=StyleProperties())
Draws a tank on the figure.
Definition codac2_Figure2D.h:1117
Ellipsoid representation.
Definition codac2_Ellipsoid.h:47
void draw_polyline(const std::vector< Vector > &x, const StyleProperties &style=StyleProperties())
Draws a polyline on the figure.
std::vector< std::shared_ptr< OutputFigure2D > > output_figures()
Returns OutputFigure2D objects rendering the current figure.
const Index & j() const
Getter for the index of the vertical axis.
Figure2D & set_axes(const FigureAxis &axis1, const FigureAxis &axis2)
Setter for the axes of the figure.
Figure2D(const std::string &name, GraphicOutput o)
Creates a new Figure2D object, with a given name and output.
void draw_trajectory(const SampledTraj< Vector > &x, const StyleProperties &style=StyleProperties())
Draws a trajectory on the figure.
const std::vector< FigureAxis > & axes() const
Getter for the axes of the figure.
void set_tdomain(const Interval &tdomain)
Setter for the time domain of the figure.
void plot_trajectory(const AnalyticTraj< ScalarType > &x, const StyleProperties &style=StyleProperties())
Plots a trajectory on the figure (x-axis is the time).
void draw_motor_boat(const Vector &x, float size, const StyleProperties &style=StyleProperties())
Draws a motor boat on the figure.
void draw_line(const Vector &p1, const Vector &p2, const StyleProperties &style=StyleProperties())
Draws a line on the figure.
void center_viewbox(const Vector &c, const Vector &r)
VIBes only: center the viewbox on a given point with a given radius.
void draw_tube(const SlicedTube< IntervalVector > &x, const StyleProperties &style, int max_nb_slices_to_display=5000)
Draws a tube of IntervalVector on the figure with some StyleProperties.
const Vector & pos() const
Getter for the position of the figure.
void draw_ring(const Vector &c, const Interval &r, const StyleProperties &style=StyleProperties())
Draws a ring on the figure.
void draw_parallelepiped(const Parallelepiped &p, const StyleProperties &style=StyleProperties())
Draws a parallelepiped z+A*[-1,1]^2 on the figure.
void draw_raster(const std::string &filename, const IntervalVector &bbox, const StyleProperties &style=StyleProperties())
Draws a raster on the figure in VIBes only, only the bounding box is drawn in IPE.
void draw_tank(const Vector &x, float size, const StyleProperties &style=StyleProperties())
Draws a tank on the figure.
void draw_arrow(const Vector &p1, const Vector &p2, float tip_length, const StyleProperties &style=StyleProperties())
Draws an arrow on the figure.
void pave(const IntervalVector &x0, const C &c, double eps, const PavingStyle &style=PavingStyle::default_style())
Draws a paving from a contractor while it is being computed.
Definition codac2_Figure2D_pave.h:78
void clear()
Clears the figure.
const Vector & window_size() const
getter for the size of the window
bool is_default() const
void set_as_default()
Sets the figure as the default view.
void draw_tube(const SlicedTube< IntervalVector > &x, const StyleGradientProperties &style=StyleGradientProperties(ColorMap::blue_tube(), "z:-1"), int max_nb_slices_to_display=5000)
Draws a tube of IntervalVector on the figure with a colormap.
void draw_circle(const Vector &c, double r, const StyleProperties &style=StyleProperties())
Draws a circle on the figure.
void draw_AUV(const Vector &x, float size, const StyleProperties &style=StyleProperties())
Draws an AUV on the figure.
void draw_subpaving(const Subpaving< P > &p, const StyleProperties &style=StyleProperties())
Draws a subpaving on the figure.
Definition codac2_Figure2D.h:648
void plot_trajectories(const SampledTraj< Vector > &x, const StyleProperties &style)
Plots a set of trajectories on the figure (x-axis is the time) with custom common color.
void draw_trajectory(const AnalyticTraj< VectorType > &x, const StyleProperties &style=StyleProperties())
Draws a trajectory on the figure.
double scaled_unit() const
Getter for the scaling factor of the figure.
void draw_text(const std::string &text, const Vector &ul, double scale, const StyleProperties &style=StyleProperties())
Draws text on the figure.
void draw_paving(const PavingOut &p, const std::function< void(Figure2D &, const IntervalVector &, const StyleProperties &)> &draw_box, const PavingStyle &style=PavingStyle::default_style())
Draws a previously computed paving (outer approximation) on the figure.
void plot_trajectories(const SampledTraj< Vector > &x)
Plots a set of trajectories on the figure (x-axis is the time) with random colors.
void draw_trajectory(const SampledTraj< Vector > &x, const StyleGradientProperties &style)
Draws a trajectory on the figure with a colormap.
const Index & i() const
Getter for the index of the horizontal axis.
void draw_ellipsoid(const Ellipsoid &e, const StyleProperties &style=StyleProperties())
Draws an ellipsoid on the figure.
const std::string & name() const
Getter for the name of the figure.
void draw_polygon(const Polygon &x, const StyleProperties &style=StyleProperties())
Draws a Polygon object on the figure.
void draw_zonotope(const Zonotope &z, const StyleProperties &style=StyleProperties())
Draws a zonotope c+sum_i [-1,1] A_i on the figure.
void plot_tube(const SlicedTube< Interval > &x, const SlicedTube< Interval > &v, const StyleProperties &style=StyleProperties())
Plots a tube on the figure (x-axis is the time), with derivative information: slices are displayed as...
void draw_paving(const PavingOut &p, const PavingStyle &style=PavingStyle::default_style())
Draws a previously computed paving (outer approximation) on the figure.
void plot_tube(const SlicedTube< Interval > &x, const StyleProperties &style=StyleProperties())
Plots a tube on the figure (x-axis is the time).
void draw_line(const Segment &e, const StyleProperties &style=StyleProperties())
Draws a line on the figure.
void draw_box(const IntervalVector &x, const StyleProperties &style=StyleProperties())
Draws a box on the figure.
void draw_trajectory(const AnalyticTraj< VectorType > &x, const StyleGradientProperties &style)
Draws a trajectory on the figure with a colormap.
void draw_ellipse(const Vector &c, const Vector &ab, double theta, const StyleProperties &style=StyleProperties())
Draws an ellipse on the figure.
Figure2D & set_axes(const IntervalVector &bbox)
Setter for the axes of the figure.
void draw_pie(const Vector &c, const Interval &r, const Interval &theta, const StyleProperties &style=StyleProperties())
Draws a pie on the figure.
void draw_paving(const PavingInOut &p, const std::function< void(Figure2D &, const IntervalVector &, const StyleProperties &)> &draw_box, const PavingStyle &style=PavingStyle::default_style())
Draws a previously computed paving (inner/outer approximation) on the figure.
Figure2D & set_projection(std::function< Vector(const Vector &)> projection, std::function< IntervalVector(const IntervalVector &)> interval_projection={})
Sets an optional coordinate projection for drawing.
void draw_point(const Vector &c, const StyleProperties &style=StyleProperties())
Draws a point on the figure.
void plot_trajectory(const SampledTraj< double > &x, const StyleProperties &style=StyleProperties())
Plots a trajectory on the figure (x-axis is the time).
void auto_scale()
VIBes only: auto scale the figure.
Index size() const
Getter for the size of the figure.
void draw_polyline(const std::vector< Vector > &x, float tip_length, const StyleProperties &style=StyleProperties())
Draws a polyline on the figure.
void set_window_properties(const Vector &pos, const Vector &size)
Setter for the position and size of the window.
void save(const std::string &filename)
Saves the figure to a file.
void draw_paving(const PavingInOut &p, const PavingStyle &style=PavingStyle::default_style())
Draws a previously computed paving (inner/outer approximation) on the figure.
Interval class, for representing closed and connected subsets of .
Definition codac2_Interval.h:50
Class representing a parallelepiped .
Definition codac2_Parallelepiped.h:31
Represents a polygon (convex or non-convex) defined by its vertices enclosed in IntervalVectors.
Definition codac2_Polygon.h:29
Represents a geometric segment defined by two points enclosed in IntervalVectors.
Definition codac2_Segment.h:28
Tube represented over a sliced temporal domain.
Definition codac2_SlicedTube.h:38
Class representing a zonotope .
Definition codac2_Zonotope.h:29
Definition codac2_OctaSym.h:21
Eigen::Matrix< double,-1, 1 > Vector
Alias for a dynamically-sized column vector of doubles.
Definition codac2_Vector.h:24
Eigen::Matrix< Interval,-1, 1 > IntervalVector
Alias for a dynamic-size column vector of intervals.
Definition codac2_IntervalVector.h:25
CtcInterType< typenameC1::ContractedTypes >::Ctc operator&(const C1 &c1, const C2 &c2)
Builds an intersection contractor from two contractors.
Definition codac2_CtcInter.h:230
static ColorMap blue_tube(float alpha=1.)
Blue tube color map.
Definition codac2_ColorMap.h:131
Style properties structure, to specify the style of a shape.
Definition codac2_StyleGradientProperties.h:27
Style properties structure, to specify the style of a shape.
Definition codac2_StyleProperties.h:27