PolarScanMatching(PSM)  1
Functions | Variables
draw.h File Reference

Go to the source code of this file.

Functions

void dr_init (int screen_x_max, int screen_y_max, double xmin, double ymin, double xmax, double ymax)
 Initialize the drawing module. More...
 
void dr_close (void)
 Close the drawing window. More...
 
void dr_line (double x1, double y1, double x2, double y2, const char *color)
 Plot a line between [x1,y1] and [x2,y2] using color. More...
 
void dr_marker (double x, double y, int type, const char *color)
 Place a marker to (x,y). Possible markers are: DR_MARKER_CIRCLE, DR_MARKER_TRIANGLE, DR_MARKER_CROSS. More...
 
void dr_text (double x, double y, int hz_al, int vr_al, const char *text, const char *color)
 Place a text to (x,y). More...
 
void dr_text_pix (int px, int py, const char *text, const char *color)
 Temporary code to output text to screen coordinates. More...
 
void dr_scale (double xmin, double ymin, double xmax, double ymax)
 Scale the shown area. Prior rescaling, the area is normalized to keep the aspect ratio. More...
 
void dr_replot (void)
 Redraw the screen content. More...
 
void dr_erase (void)
 Clear the screen and erase the drawn objects from memory. More...
 
void dr_circle (double x, double y, double r, const char *color)
 Plot a circle of radius r at [x,y] using color. More...
 
void dr_cov_ellipse (double x, double y, double c11, double c12, double c22, const char *color)
 Plot a covariance ellipse to depict uncertainty. More...
 
void dr_zoom (void)
 Interactive zooming until enter, space or 'q' is pressed. More...
 
void dr_fit (void)
 Scale all drawn objects to fit the screen. More...
 
void dr_save (const char *filename)
 Save the screen into a PNG image (needs extra packages). More...
 
void dr_equal (int equal)
 Enable or disable equal drawing unit per pixel ratio for both axis. More...
 
void dr_print_database (void)
 Debug function to print buffer. More...
 

Variables

char * dr_COLORS []
 
int dr_COLORS_CNT
 

Function Documentation

void dr_circle ( double  x,
double  y,
double  r,
const char *  color 
)

Plot a circle of radius r at [x,y] using color.

Parameters
xX coordinate of the center of the circle.
yY coordinate of the center of the circle.
rRadius of the circle.
colorThe color of the circle as "red", "green",... see dr_COLORS.
void dr_close ( void  )

Close the drawing window.

void dr_cov_ellipse ( double  x,
double  y,
double  cxx,
double  cxy,
double  cyy,
const char *  color 
)

Plot a covariance ellipse to depict uncertainty.

The covariance ellipse is drawn by breaking it up into line segments.

Acknowledgement: the core equations are from Lindsay's kzoom.

Parameters
xX coordinate of the mean of the distribution.
yY coordinate of the mean of the distribution.
cxxThe variance of the X coordinate.
cxyThe XY covariance.
cyyThe variance of the Y coordinate.
colorThe color of the ellipse as "red", "green",... see dr_COLORS.
void dr_equal ( int  equal)

Enable or disable equal drawing unit per pixel ratio for both axis.

Parameters
equal1 - enabled, 0 - disabled
void dr_erase ( void  )

Clear the screen and erase the drawn objects from memory.

void dr_fit ( void  )

Scale all drawn objects to fit the screen.

void dr_init ( int  screen_x_max,
int  screen_y_max,
double  xmin,
double  ymin,
double  xmax,
double  ymax 
)

Initialize the drawing module.

Parameters
screen_y_max[pixel] The height of the drawing screen in pixels.
screen_x_max[pixel] The width of the drawing screen in pixels.
xminMinimum x coordinate of the drawing area in drawing units.
yminMinimum y coordinate of the drawing area in drawing units.
xmaxMaximum x coordinate of the drawing area in drawing units.
ymaxMaximum y coordinate of the drawing area in drawing units.
void dr_line ( double  x1,
double  y1,
double  x2,
double  y2,
const char *  color 
)

Plot a line between [x1,y1] and [x2,y2] using color.

Parameters
x1x coordinate of the first point.
y1y coordinate of the first point.
x2x coordinate of the second point.
y2y coordinate of the second point.
colorThe color of the line as "red", "green",... see dr_COLORS.
void dr_marker ( double  x,
double  y,
int  type,
const char *  color 
)

Place a marker to (x,y). Possible markers are: DR_MARKER_CIRCLE, DR_MARKER_TRIANGLE, DR_MARKER_CROSS.

Parameters
xX coordinate of the marker.
yY coordinate of the marker.
typeThe type of the marker. One of DR_MARKER_CIRCLE, DR_MARKER_TRIANGLE, DR_MARKER_CROSS.
colorThe color of the marker as "red", "green",... see dr_COLORS.
void dr_print_database ( void  )

Debug function to print buffer.

void dr_replot ( void  )

Redraw the screen content.

void dr_save ( const char *  filename)

Save the screen into a PNG image (needs extra packages).

Parameters
filenameThe name of the file under which the image is saved.
void dr_scale ( double  xmin,
double  ymin,
double  xmax,
double  ymax 
)

Scale the shown area. Prior rescaling, the area is normalized to keep the aspect ratio.

Parameters
xminMinimum X coordinate of the shown area.
yminMinimum Y coordinate of the shown area.
xmaxMaximum X coordinate of the shown area.
ymaxMaximum X coordinate of the shown area.
void dr_text ( double  x,
double  y,
int  hz_al,
int  vr_al,
const char *  text,
const char *  color 
)

Place a text to (x,y).

Parameters
xX coordinate of the text.
yY coordinate of the text.
hz_alHorizontal alignment. - CURRENTLY NOT USED.
vr_alHorizontal alignment. - CURRENTLY NOT USED.
textThe text to be shown.
colorThe color of the marker as "red", "green",... see dr_COLORS.
void dr_text_pix ( int  px,
int  py,
const char *  text,
const char *  color 
)

Temporary code to output text to screen coordinates.

Parameters
px[Pixel] X coordinate of the text.
py[Pixel] Y coordinate of the text.
textThe text to be shown.
colorThe color of the marker as "red", "green",... see dr_COLORS.
void dr_zoom ( void  )

Interactive zooming until enter, space or 'q' is pressed.

Use mouse or numeric keypad to pan/zoom. On the numeric keypad 9,3 will zoom in/out, 2,8 will move the drawing up/down, 4,6 will move left/right. Push r to redraw and c to reset to initial zoom level and view position.

When using the mouse, left click on figure top/bottom will move the drawing down/up, clicking on the left or right side of the figure will move the drawing right or left. Moving the wheel will zoom in and out.

Variable Documentation

char* dr_COLORS[]
int dr_COLORS_CNT