codac 2.0.0
|
Figure2D class, used for 2D display. More...
#include <codac2_Figure2D.h>
Public Member Functions | |
Figure2D (const std::string &name, GraphicOutput o, bool set_as_default=false) | |
Creates a new Figure2D object, with a given name and output. | |
const std::string & | name () const |
Getter for the name of the figure. | |
Index | size () const |
Getter for the size of the figure. | |
const std::vector< FigureAxis > & | axes () const |
Getter for the axes of the figure. | |
Figure2D & | set_axes (const FigureAxis &axis1, const FigureAxis &axis2) |
Setter for the axes of the figure. | |
const Index & | i () const |
Getter for the index of the horizontal axis. | |
const Index & | j () const |
Getter for the index of the vertical axis. | |
const Vector & | pos () const |
Getter for the position of the figure. | |
const Vector & | window_size () const |
getter for the size of the window | |
void | set_window_properties (const Vector &pos, const Vector &size) |
Setter for the position and size of the window. | |
void | center_viewbox (const Vector &c, const Vector &r) |
VIBes only: center the viewbox on a given point with a given radius. | |
void | clear () |
Clears the figure. | |
double | scaled_unit () const |
Getter for the scaling factor of the figure. | |
void | auto_scale () |
VIBes only: auto scale the figure. | |
bool | is_default () const |
void | set_as_default () |
Sets the figure as the default view. | |
void | set_tdomain (const Interval &tdomain) |
Setter for the time domain of the figure. | |
void | draw_point (const Vector &c, const StyleProperties &s=StyleProperties()) |
Draws a point on the figure. | |
void | draw_box (const IntervalVector &x, const StyleProperties &s=StyleProperties()) |
Draws a box on the figure. | |
void | draw_circle (const Vector &c, double r, const StyleProperties &s=StyleProperties()) |
Draws a circle on the figure. | |
void | draw_ring (const Vector &c, const Interval &r, const StyleProperties &s=StyleProperties()) |
Draws a ring on the figure. | |
void | draw_line (const Vector &p1, const Vector &p2, const StyleProperties &s=StyleProperties()) |
Draws a line on the figure. | |
void | draw_line (const Segment &e, const StyleProperties &s=StyleProperties()) |
Draws a line on the figure. | |
void | draw_arrow (const Vector &p1, const Vector &p2, float tip_length, const StyleProperties &s=StyleProperties()) |
Draws an arrow on the figure. | |
void | draw_polyline (const std::vector< Vector > &x, const StyleProperties &s=StyleProperties()) |
Draws a polyline on the figure. | |
void | draw_polyline (const std::vector< Vector > &x, float tip_length, const StyleProperties &s=StyleProperties()) |
Draws a polyline on the figure. | |
void | draw_polygon (const Polygon &x, const StyleProperties &s=StyleProperties()) |
Draws a Polygon object on the figure. | |
void | draw_parallelepiped (const Parallelepiped &p, const StyleProperties &s=StyleProperties()) |
Draws a parallelepiped z+A*[-1,1]^2 on the figure. | |
void | draw_zonotope (const Zonotope &z, const StyleProperties &s=StyleProperties()) |
Draws a zonotope z+sum_i [-1,1] A_i on the figure. | |
void | draw_pie (const Vector &c, const Interval &r, const Interval &theta, const StyleProperties &s=StyleProperties()) |
Draws a pie on the figure. | |
void | draw_ellipse (const Vector &c, const Vector &ab, double theta, const StyleProperties &s=StyleProperties()) |
Draws an ellipse on the figure. | |
void | draw_ellipsoid (const Ellipsoid &e, const StyleProperties &s=StyleProperties()) |
Draws an ellipsoid on the figure. | |
void | draw_trajectory (const SampledTraj< Vector > &x, const StyleProperties &s=StyleProperties()) |
Draws a trajectory on the figure. | |
void | draw_trajectory (const AnalyticTraj< VectorType > &x, const StyleProperties &s=StyleProperties()) |
Draws a trajectory on the figure. | |
void | draw_trajectory (const SampledTraj< Vector > &x, const ColorMap &cmap) |
Draws a trajectory on the figure with a colormap. | |
void | draw_trajectory (const AnalyticTraj< VectorType > &x, const ColorMap &cmap) |
Draws a trajectory on the figure with a colormap. | |
void | plot_trajectory (const SampledTraj< double > &x, const StyleProperties &s=StyleProperties()) |
Plots a trajectory on the figure (x-axis is the time) | |
void | plot_trajectories (const SampledTraj< Vector > &x, const StyleProperties &s=StyleProperties()) |
Plots a set of trajectories on the figure (x-axis is the time) | |
void | draw_tube (const SlicedTube< IntervalVector > &x, const StyleProperties &s) |
Draws a tube of IntervalVector on the figure. | |
void | draw_tube (const SlicedTube< IntervalVector > &x, const ColorMap &cmap=ColorMap::blue_tube()) |
Draws a tube of IntervalVector on the figure with a colormap. | |
void | draw_tank (const Vector &x, float size, const StyleProperties &s=StyleProperties()) |
Draws a tank on the figure. | |
void | draw_AUV (const Vector &x, float size, const StyleProperties &s=StyleProperties()) |
Draws an AUV on the figure. | |
void | draw_motor_boat (const Vector &x, float size, const StyleProperties &s=StyleProperties()) |
Draws a motor boat on the figure. | |
void | draw_paving (const PavingOut &p, const PavingStyle &style=PavingStyle::default_style()) |
Draws a previously computed paving (outer approximation) 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 | draw_paving (const PavingInOut &p, const PavingStyle &style=PavingStyle::default_style()) |
Draws a previously computed paving (inner/outer approximation) 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. | |
template<typename C> requires IsCtcBaseOrPtr<C,IntervalVector> | |
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. | |
template<typename C> requires IsCtcBaseOrPtr<C,IntervalVector> | |
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. | |
template<typename S> requires IsSepBaseOrPtr<S> | |
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. | |
template<typename S> requires IsSepBaseOrPtr<S> | |
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. | |
template<typename P> | |
void | draw_subpaving (const Subpaving< P > &p, const StyleProperties &s=StyleProperties()) |
Draws a subpaving on the figure. | |
Figure2D class, used for 2D display.
This class is used to display 2D figures.
Currently, it can interact with VIBes and IPE.
For VIBes, the server must be launched before using this class.
For IPE, an xml file is generated and can be opened with the IPE editor.
codac2::Figure2D::Figure2D | ( | const std::string & | name, |
GraphicOutput | o, | ||
bool | set_as_default = false ) |
Creates a new Figure2D object, with a given name and output.
name | Name of the figure |
o | Output of the figure, can be VIBes or IPE (or both) |
set_as_default | (optionnal) If true, the figure is set as the default view, default is false |
const std::string & codac2::Figure2D::name | ( | ) | const |
Getter for the name of the figure.
Index codac2::Figure2D::size | ( | ) | const |
Getter for the size of the figure.
const std::vector< FigureAxis > & codac2::Figure2D::axes | ( | ) | const |
Getter for the axes of the figure.
Figure2D & codac2::Figure2D::set_axes | ( | const FigureAxis & | axis1, |
const FigureAxis & | axis2 ) |
Setter for the axes of the figure.
axis1 | First axis (horizontal) |
axis2 | Second axis (vertical) |
const Index & codac2::Figure2D::i | ( | ) | const |
Getter for the index of the horizontal axis.
const Index & codac2::Figure2D::j | ( | ) | const |
Getter for the index of the vertical axis.
const Vector & codac2::Figure2D::pos | ( | ) | const |
Getter for the position of the figure.
const Vector & codac2::Figure2D::window_size | ( | ) | const |
getter for the size of the window
Setter for the position and size of the window.
pos | Position of the window |
size | Size of the window |
VIBes only: center the viewbox on a given point with a given radius.
c | Center of the viewbox |
r | Radius of the viewbox |
double codac2::Figure2D::scaled_unit | ( | ) | const |
Getter for the scaling factor of the figure.
bool codac2::Figure2D::is_default | ( | ) | const |
void codac2::Figure2D::set_tdomain | ( | const Interval & | tdomain | ) |
Setter for the time domain of the figure.
tdomain | The new time domain |
void codac2::Figure2D::draw_point | ( | const Vector & | c, |
const StyleProperties & | s = StyleProperties() ) |
Draws a point on the figure.
c | Coordinates of the point |
s | Style of the point (edge color and fill color) |
void codac2::Figure2D::draw_box | ( | const IntervalVector & | x, |
const StyleProperties & | s = StyleProperties() ) |
Draws a box on the figure.
x | Box to draw |
s | Style of the box (edge color and fill color) |
void codac2::Figure2D::draw_circle | ( | const Vector & | c, |
double | r, | ||
const StyleProperties & | s = StyleProperties() ) |
Draws a circle on the figure.
c | Center of the circle |
r | Radius of the circle |
s | Style of the circle (edge color and fill color) |
void codac2::Figure2D::draw_ring | ( | const Vector & | c, |
const Interval & | r, | ||
const StyleProperties & | s = StyleProperties() ) |
Draws a ring on the figure.
c | Center of the ring |
r | Inner and outer radius of the ring |
s | Style of the ring (edge color and fill color) |
void codac2::Figure2D::draw_line | ( | const Vector & | p1, |
const Vector & | p2, | ||
const StyleProperties & | s = StyleProperties() ) |
Draws a line on the figure.
p1 | First point of the line |
p2 | Second point of the line |
s | Style of the line (edge color) |
void codac2::Figure2D::draw_line | ( | const Segment & | e, |
const StyleProperties & | s = StyleProperties() ) |
Draws a line on the figure.
e | segment to be drawn |
s | Style of the line (edge color) |
void codac2::Figure2D::draw_arrow | ( | const Vector & | p1, |
const Vector & | p2, | ||
float | tip_length, | ||
const StyleProperties & | s = StyleProperties() ) |
Draws an arrow on the figure.
p1 | First point of the arrow |
p2 | Second point of the arrow |
tip_length | Length of the tip of the arrow |
s | Style of the arrow (edge color and fill color) |
void codac2::Figure2D::draw_polyline | ( | const std::vector< Vector > & | x, |
const StyleProperties & | s = StyleProperties() ) |
Draws a polyline on the figure.
x | Vector of the points of the polyline |
s | Style of the polyline (edge color) |
void codac2::Figure2D::draw_polyline | ( | const std::vector< Vector > & | x, |
float | tip_length, | ||
const StyleProperties & | s = StyleProperties() ) |
Draws a polyline on the figure.
x | Vector of the points of the polyline |
tip_length | Length of the tip of the arrow |
s | Style of the polyline (edge color and fill color) |
void codac2::Figure2D::draw_polygon | ( | const Polygon & | x, |
const StyleProperties & | s = StyleProperties() ) |
void codac2::Figure2D::draw_parallelepiped | ( | const Parallelepiped & | p, |
const StyleProperties & | s = StyleProperties() ) |
Draws a parallelepiped z+A*[-1,1]^2 on the figure.
p | Parallelepiped to draw (center and shape matrix) |
s | Style of the parallelepiped (edge color and fill color) |
void codac2::Figure2D::draw_zonotope | ( | const Zonotope & | z, |
const StyleProperties & | s = StyleProperties() ) |
Draws a zonotope z+sum_i [-1,1] A_i on the figure.
z | Zonotope to draw (center and shape matrix) |
s | Style of the zonotope (edge color and fill color) |
void codac2::Figure2D::draw_pie | ( | const Vector & | c, |
const Interval & | r, | ||
const Interval & | theta, | ||
const StyleProperties & | s = StyleProperties() ) |
Draws a pie on the figure.
c | Center of the pie |
r | Inner and outer radius of the pie |
theta | Start and end angle of the pie (in radians) |
s | Style of the pie (edge color and fill color) |
void codac2::Figure2D::draw_ellipse | ( | const Vector & | c, |
const Vector & | ab, | ||
double | theta, | ||
const StyleProperties & | s = StyleProperties() ) |
Draws an ellipse on the figure.
c | Center of the ellipse |
ab | Half-lengths of the ellipse |
theta | Rotation angle of the ellipse (in radians) |
s | Style of the ellipse (edge color and fill color) |
void codac2::Figure2D::draw_ellipsoid | ( | const Ellipsoid & | e, |
const StyleProperties & | s = StyleProperties() ) |
Draws an ellipsoid on the figure.
e | Ellipsoid to draw |
s | Style of the ellipsoid (edge color and fill color) |
void codac2::Figure2D::draw_trajectory | ( | const SampledTraj< Vector > & | x, |
const StyleProperties & | s = StyleProperties() ) |
Draws a trajectory on the figure.
x | SampledTraj to draw |
s | Style of the trajectory (edge color) |
void codac2::Figure2D::draw_trajectory | ( | const AnalyticTraj< VectorType > & | x, |
const StyleProperties & | s = StyleProperties() ) |
Draws a trajectory on the figure.
x | AnalyticTraj to draw |
s | Style of the trajectory (edge color) |
Draws a trajectory on the figure with a colormap.
x | SampledTraj to plot |
cmap | Colormap to use |
void codac2::Figure2D::draw_trajectory | ( | const AnalyticTraj< VectorType > & | x, |
const ColorMap & | cmap ) |
Draws a trajectory on the figure with a colormap.
x | AnalyticTraj to plot |
cmap | Colormap to use |
void codac2::Figure2D::plot_trajectory | ( | const SampledTraj< double > & | x, |
const StyleProperties & | s = StyleProperties() ) |
Plots a trajectory on the figure (x-axis is the time)
x | SampledTraj to plot |
s | Style of the trajectory (edge color) |
void codac2::Figure2D::plot_trajectories | ( | const SampledTraj< Vector > & | x, |
const StyleProperties & | s = StyleProperties() ) |
Plots a set of trajectories on the figure (x-axis is the time)
x | SampledTraj<Vector> set of trajectories to plot |
s | Style of the trajectory (edge color) |
void codac2::Figure2D::draw_tube | ( | const SlicedTube< IntervalVector > & | x, |
const StyleProperties & | s ) |
Draws a tube of IntervalVector
on the figure.
x | SlicedTube to draw |
s | Style of the tube |
void codac2::Figure2D::draw_tube | ( | const SlicedTube< IntervalVector > & | x, |
const ColorMap & | cmap = ColorMap::blue_tube() ) |
Draws a tube of IntervalVector
on the figure with a colormap.
x | SlicedTube to draw |
cmap | Colormap to use |
void codac2::Figure2D::draw_tank | ( | const Vector & | x, |
float | size, | ||
const StyleProperties & | s = StyleProperties() ) |
Draws a tank on the figure.
x | Coordinates of the tank |
size | Size of the tank |
s | Style of the tank (edge color and fill color) |
void codac2::Figure2D::draw_AUV | ( | const Vector & | x, |
float | size, | ||
const StyleProperties & | s = StyleProperties() ) |
Draws an AUV on the figure.
x | Coordinates of the AUV |
size | Size of the AUV |
s | Style of the AUV (edge color and fill color) |
void codac2::Figure2D::draw_motor_boat | ( | const Vector & | x, |
float | size, | ||
const StyleProperties & | s = StyleProperties() ) |
Draws a motor boat on the figure.
x | Coordinates of the motor boat |
size | Size of the motor boat |
s | Style of the motor boat (edge color and fill color) |
void codac2::Figure2D::draw_paving | ( | const PavingOut & | p, |
const PavingStyle & | style = PavingStyle::default_style() ) |
Draws a previously computed paving (outer approximation) on the figure.
p | PavingOut to draw (result of a paving with contractors) |
style | PavingStyle for the drawing |
void codac2::Figure2D::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.
p | PavingOut to draw (result of a paving with contractors) |
draw_box | Custom drawing function (for instance, if one wants to draw in polar coordinates) |
style | PavingStyle for the drawing |
void codac2::Figure2D::draw_paving | ( | const PavingInOut & | p, |
const PavingStyle & | style = PavingStyle::default_style() ) |
Draws a previously computed paving (inner/outer approximation) on the figure.
p | PavingInOut to draw (result of a paving with separators) |
style | PavingStyle for the drawing |
void codac2::Figure2D::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.
p | PavingInOut to draw (result of a paving with separators) |
draw_box | Custom drawing function (for instance, if one wants to draw in polar coordinates) |
style | PavingStyle for the drawing |
|
inline |
Draws a paving from a contractor while it is being computed.
x0 | Initial box |
c | Contractor to be paved |
eps | Accuracy of the paving algorithm (the undefined boxes will have their max_diam <= eps) |
style | PavingStyle for the drawing |
|
inline |
Draws a paving from a contractor while it is being computed.
x0 | Initial box |
c | Contractor to be paved |
eps | Accuracy of the paving algorithm (the undefined boxes will have their max_diam <= eps) |
draw_box | Optional custom drawing function (for instance, if one wants to draw in polar coordinates) |
style | PavingStyle for the drawing |
|
inline |
Draws a paving from a separator while it is being computed.
x0 | Initial box |
s | Separator to be paved |
eps | Accuracy of the paving algorithm (the undefined boxes will have their max_diam <= eps) |
style | PavingStyle for the drawing |
|
inline |
Draws a paving from a separator while it is being computed.
x0 | Initial box |
s | Separator to be paved |
eps | Accuracy of the paving algorithm (the undefined boxes will have their max_diam <= eps) |
draw_box | Optional custom drawing function (for instance, if one wants to draw in polar coordinates) |
style | PavingStyle for the drawing |
|
inline |
Draws a subpaving on the figure.
p | Subpaving to draw |
s | Style of the subpaving |