@@ -38,4 +38,57 @@ int main(){
3838
3939 // The previously declared figure "fig2" can now be used as a DefaultView
4040 DefaultView::set (fig2);
41+ DefaultView::draw_box ({{2.2 ,2.5 },{2.2 ,2.5 }},{Color::black (),Color::green (0.8 )});
42+
43+ DefaultView::set (fig1);
44+ DefaultView::draw_box ({{2.2 ,2.5 },{2.2 ,2.5 }},{Color::blue (),Color::cyan (0.8 )});
45+
46+ fig2->draw_AUV ({1 ,1 ,3.14 /2 },2 .,{Color::black (),Color::yellow ()});
47+ fig2->draw_tank ({2 ,1 ,3.14 /2 },1 .,{Color::black (),Color::yellow ()});
48+ fig2->draw_pie ({2 ,2 },{1.5 ,2.5 },{(3 *3.14 /4 )-0.5 ,(3 *3.14 /4 )+0.5 },{Color::blue (),Color::cyan ()});
49+ fig2->draw_polyline ({{2 ,-0.5 },{4 ,0.5 },{3 ,1.5 },{4 ,2.5 },{3 ,3 }}, Color::red ());
50+ fig2->draw_polygone ({{2 ,4.5 },{4 ,4.5 },{4.2 ,3.5 },{3.5 ,3 }}, {Color::none (),Color::green (0.5 )});
51+ fig2->draw_polyline ({{-0.8 ,0 },{0 ,1.5 }}, 0.2 , {Color::red (),Color::black (0.3 )});
52+ fig2->draw_ellipse ({1 ,1 },{0.5 ,2 }, 0.2 , {Color::blue (),Color::blue (0.3 )});
53+ fig2->draw_line ({1 ,1 },{3 ,3 }, Color::blue ());
54+ fig2->draw_arrow ({3 ,1 },{2.2 ,2 }, 0.2 , {Color::red (),Color::black (0.3 )});
55+
56+ // Colors
57+ // predefined colors without and with opacity
58+ fig2->draw_point ({2 ,2 }, {Color::red (),Color::yellow (0.5 )});
59+ // HTML color without and with opacity
60+ fig2->draw_box ({{2.4 ,2.9 },{2.4 ,2.9 }},{Color (" #da3907" ),Color (" #da390755" )});
61+ // HSV color without and with opacity
62+ fig2->draw_box ({{2.6 ,3.1 },{2.6 ,3.1 }},{Color ({108 ,90 ,78 },Model::HSV),Color ({108 ,90 ,78 ,20 },Model::HSV)});
63+
64+ Figure2D fig3 (" My Figure 3" ,GraphicOutput::VIBES|GraphicOutput::IPE);
65+ fig3.set_axes (axis (0 ,{-1 ,21 }), axis (1 ,{-5.5 ,0.5 }));
66+ fig3.set_window_properties ({800 ,250 },{500 ,500 });
67+
68+ ColorMap cmap_haxby = ColorMap::haxby ();
69+ ColorMap cmap_default = ColorMap::basic ();
70+ ColorMap cmap_blue_tube = ColorMap::blue_tube ();
71+ ColorMap cmap_red_tube = ColorMap::red_tube ();
72+ ColorMap cmap_rainbow = ColorMap::rainbow ();
73+
74+ for (double i=0 .; i<20 ; i++)
75+ {
76+ double ratio = i/20 .;
77+ fig3.draw_box ({{i,i+1 },{-1 ,0 }},{Color::black (),cmap_haxby.color (ratio)});
78+ fig3.draw_box ({{i,i+1 },{-2 ,-1 }},{Color::black (),cmap_default.color (ratio)});
79+ fig3.draw_box ({{i,i+1 },{-3 ,-2 }},{Color::black (),cmap_blue_tube.color (ratio)});
80+ fig3.draw_box ({{i,i+1 },{-4 ,-3 }},{Color::black (),cmap_red_tube.color (ratio)});
81+ fig3.draw_box ({{i,i+1 },{-5 ,-4 }},{Color::black (),cmap_rainbow.color (ratio)});
82+ }
83+
84+ Figure2D fig4 (" My Figure 4" ,GraphicOutput::VIBES);
85+
86+ fig4.set_axes (axis (0 ,{-10 ,10 }), axis (1 ,{-10 ,10 }));
87+
88+ double a=0.5 ;
89+ ScalarVar t;
90+ // Fermat's spiral
91+ AnalyticFunction f1 ({t},{a*sqrt (t)*cos (t),a*sqrt (t)*sin (t)});
92+ AnalyticTraj traj4 (f1,{0 ,100 });
93+ fig4.draw_trajectory (traj4,ColorMap::rainbow ());
4194}
0 commit comments