codac 2.0.0
Loading...
Searching...
No Matches
codac2::Figure2D Class Reference

Figure2D class, used for 2D display. More...

#include <codac2_Figure2D.h>

Collaboration diagram for codac2::Figure2D:

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.
 
void 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.
 
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 Vector &z, const Matrix &A, const StyleProperties &s=StyleProperties())
 Draws a parallelepiped z+A*[-1,1]^2 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 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 StyleProperties &bound_s=StyleProperties::boundary(), const StyleProperties &out_s=StyleProperties::outside())
 Draws a paving on the figure.
 
void draw_paving (const PavingInOut &p, const StyleProperties &bound_s=StyleProperties::boundary(), const StyleProperties &out_s=StyleProperties::outside(), const StyleProperties &in_s=StyleProperties::inside())
 Draws a paving on the figure.
 
template<typename P>
void draw_subpaving (const Subpaving< P > &p, const StyleProperties &s=StyleProperties())
 Draws a subpaving on the figure.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Figure2D()

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.

Parameters
nameName of the figure
oOutput 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

Member Function Documentation

◆ name()

const std::string & codac2::Figure2D::name ( ) const

Getter for the name of the figure.

Returns
The name of the figure

◆ size()

Index codac2::Figure2D::size ( ) const

Getter for the size of the figure.

Returns
The size of the figure

◆ axes()

const std::vector< FigureAxis > & codac2::Figure2D::axes ( ) const

Getter for the axes of the figure.

Returns
A vector of the axes of the figure

◆ set_axes()

void codac2::Figure2D::set_axes ( const FigureAxis & axis1,
const FigureAxis & axis2 )

Setter for the axes of the figure.

Parameters
axis1First axis (horizontal)
axis2Second axis (vertical)

◆ i()

const Index & codac2::Figure2D::i ( ) const

Getter for the index of the horizontal axis.

Returns
The index of the horizontal axis

◆ j()

const Index & codac2::Figure2D::j ( ) const

Getter for the index of the vertical axis.

Returns
The index of the vertical axis

◆ pos()

const Vector & codac2::Figure2D::pos ( ) const

Getter for the position of the figure.

Returns
The position of the figure

◆ window_size()

const Vector & codac2::Figure2D::window_size ( ) const

getter for the size of the window

Returns
The size of the window

◆ set_window_properties()

void codac2::Figure2D::set_window_properties ( const Vector & pos,
const Vector & size )

Setter for the position and size of the window.

Parameters
posPosition of the window
sizeSize of the window

◆ center_viewbox()

void codac2::Figure2D::center_viewbox ( const Vector & c,
const Vector & r )

VIBes only: center the viewbox on a given point with a given radius.

Parameters
cCenter of the viewbox
rRadius of the viewbox

◆ scaled_unit()

double codac2::Figure2D::scaled_unit ( ) const

Getter for the scaling factor of the figure.

Returns
The scaling factor of the figure

◆ is_default()

bool codac2::Figure2D::is_default ( ) const
Returns
True if the figure is the default view
True if the figure is the default view, false otherwise

◆ set_tdomain()

void codac2::Figure2D::set_tdomain ( const Interval & tdomain)

Setter for the time domain of the figure.

Parameters
tdomainThe new time domain

◆ draw_point()

void codac2::Figure2D::draw_point ( const Vector & c,
const StyleProperties & s = StyleProperties() )

Draws a point on the figure.

Parameters
cCoordinates of the point
sStyle of the point (edge color and fill color)

◆ draw_box()

void codac2::Figure2D::draw_box ( const IntervalVector & x,
const StyleProperties & s = StyleProperties() )

Draws a box on the figure.

Parameters
xBox to draw
sStyle of the box (edge color and fill color)

◆ draw_circle()

void codac2::Figure2D::draw_circle ( const Vector & c,
double r,
const StyleProperties & s = StyleProperties() )

Draws a circle on the figure.

Parameters
cCenter of the circle
rRadius of the circle
sStyle of the circle (edge color and fill color)

◆ draw_ring()

void codac2::Figure2D::draw_ring ( const Vector & c,
const Interval & r,
const StyleProperties & s = StyleProperties() )

Draws a ring on the figure.

Parameters
cCenter of the ring
rInner and outer radius of the ring
sStyle of the ring (edge color and fill color)

◆ draw_line() [1/2]

void codac2::Figure2D::draw_line ( const Vector & p1,
const Vector & p2,
const StyleProperties & s = StyleProperties() )

Draws a line on the figure.

Parameters
p1First point of the line
p2Second point of the line
sStyle of the line (edge color)

◆ draw_line() [2/2]

void codac2::Figure2D::draw_line ( const Segment & e,
const StyleProperties & s = StyleProperties() )

Draws a line on the figure.

Parameters
esegment to be drawn
sStyle of the line (edge color)

◆ draw_arrow()

void codac2::Figure2D::draw_arrow ( const Vector & p1,
const Vector & p2,
float tip_length,
const StyleProperties & s = StyleProperties() )

Draws an arrow on the figure.

Parameters
p1First point of the arrow
p2Second point of the arrow
tip_lengthLength of the tip of the arrow
sStyle of the arrow (edge color and fill color)

◆ draw_polyline() [1/2]

void codac2::Figure2D::draw_polyline ( const std::vector< Vector > & x,
const StyleProperties & s = StyleProperties() )

Draws a polyline on the figure.

Parameters
xVector of the points of the polyline
sStyle of the polyline (edge color)

◆ draw_polyline() [2/2]

void codac2::Figure2D::draw_polyline ( const std::vector< Vector > & x,
float tip_length,
const StyleProperties & s = StyleProperties() )

Draws a polyline on the figure.

Parameters
xVector of the points of the polyline
tip_lengthLength of the tip of the arrow
sStyle of the polyline (edge color and fill color)

◆ draw_polygon()

void codac2::Figure2D::draw_polygon ( const Polygon & x,
const StyleProperties & s = StyleProperties() )

Draws a Polygon object on the figure.

Parameters
xthe Polygon object to be displayed
sStyle of the polygone (edge color and fill color)

◆ draw_parallelepiped()

void codac2::Figure2D::draw_parallelepiped ( const Vector & z,
const Matrix & A,
const StyleProperties & s = StyleProperties() )

Draws a parallelepiped z+A*[-1,1]^2 on the figure.

Parameters
zCoordinates of the center of the parallelepiped
AMatrix of the parallelepiped
sStyle of the parallelepiped (edge color and fill color)

◆ draw_pie()

void codac2::Figure2D::draw_pie ( const Vector & c,
const Interval & r,
const Interval & theta,
const StyleProperties & s = StyleProperties() )

Draws a pie on the figure.

Parameters
cCenter of the pie
rInner and outer radius of the pie
thetaStart and end angle of the pie (in radians)
sStyle of the pie (edge color and fill color)

◆ draw_ellipse()

void codac2::Figure2D::draw_ellipse ( const Vector & c,
const Vector & ab,
double theta,
const StyleProperties & s = StyleProperties() )

Draws an ellipse on the figure.

Parameters
cCenter of the ellipse
abHalf-lengths of the ellipse
thetaRotation angle of the ellipse (in radians)
sStyle of the ellipse (edge color and fill color)

◆ draw_ellipsoid()

void codac2::Figure2D::draw_ellipsoid ( const Ellipsoid & e,
const StyleProperties & s = StyleProperties() )

Draws an ellipsoid on the figure.

Parameters
eEllipsoid to draw
sStyle of the ellipsoid (edge color and fill color)

◆ draw_trajectory() [1/4]

void codac2::Figure2D::draw_trajectory ( const SampledTraj< Vector > & x,
const StyleProperties & s = StyleProperties() )

Draws a trajectory on the figure.

Parameters
xSampledTraj to draw
sStyle of the trajectory (edge color)

◆ draw_trajectory() [2/4]

void codac2::Figure2D::draw_trajectory ( const AnalyticTraj< VectorType > & x,
const StyleProperties & s = StyleProperties() )

Draws a trajectory on the figure.

Parameters
xAnalyticTraj to draw
sStyle of the trajectory (edge color)

◆ draw_trajectory() [3/4]

void codac2::Figure2D::draw_trajectory ( const SampledTraj< Vector > & x,
const ColorMap & cmap )

Draws a trajectory on the figure with a colormap.

Parameters
xSampledTraj to plot
cmapColormap to use

◆ draw_trajectory() [4/4]

void codac2::Figure2D::draw_trajectory ( const AnalyticTraj< VectorType > & x,
const ColorMap & cmap )

Draws a trajectory on the figure with a colormap.

Parameters
xAnalyticTraj to plot
cmapColormap to use

◆ plot_trajectory()

void codac2::Figure2D::plot_trajectory ( const SampledTraj< double > & x,
const StyleProperties & s = StyleProperties() )

Plots a trajectory on the figure (x-axis is the time)

Parameters
xSampledTraj to plot
sStyle of the trajectory (edge color)

◆ draw_tank()

void codac2::Figure2D::draw_tank ( const Vector & x,
float size,
const StyleProperties & s = StyleProperties() )

Draws a tank on the figure.

Parameters
xCoordinates of the tank
sizeSize of the tank
sStyle of the tank (edge color and fill color)

◆ draw_AUV()

void codac2::Figure2D::draw_AUV ( const Vector & x,
float size,
const StyleProperties & s = StyleProperties() )

Draws an AUV on the figure.

Parameters
xCoordinates of the AUV
sizeSize of the AUV
sStyle of the AUV (edge color and fill color)

◆ draw_motor_boat()

void codac2::Figure2D::draw_motor_boat ( const Vector & x,
float size,
const StyleProperties & s = StyleProperties() )

Draws a motor boat on the figure.

Parameters
xCoordinates of the motor boat
sizeSize of the motor boat
sStyle of the motor boat (edge color and fill color)

◆ draw_paving() [1/2]

void codac2::Figure2D::draw_paving ( const PavingOut & p,
const StyleProperties & bound_s = StyleProperties::boundary(),
const StyleProperties & out_s = StyleProperties::outside() )

Draws a paving on the figure.

Parameters
pPavingOut to draw (result of a paving with contractors)
bound_sStyle of the boundary of the paving
out_sStyle of the outside of the paving

◆ draw_paving() [2/2]

void codac2::Figure2D::draw_paving ( const PavingInOut & p,
const StyleProperties & bound_s = StyleProperties::boundary(),
const StyleProperties & out_s = StyleProperties::outside(),
const StyleProperties & in_s = StyleProperties::inside() )

Draws a paving on the figure.

Parameters
pPavingInOut to draw (result of a paving with separators)
bound_sStyle of the boundary of the paving
out_sStyle of the outside of the paving
in_sStyle of the inside of the paving

◆ draw_subpaving()

template<typename P>
void codac2::Figure2D::draw_subpaving ( const Subpaving< P > & p,
const StyleProperties & s = StyleProperties() )
inline

Draws a subpaving on the figure.

Parameters
pSubpaving to draw
sStyle of the subpaving
421 {
422 for(const auto& pi : p.boxes())
423 draw_box(pi, s);
424 }
void draw_box(const IntervalVector &x, const StyleProperties &s=StyleProperties())
Draws a box on the figure.

The documentation for this class was generated from the following file: