PolarScanMatching(PSM)  1
draw.h
Go to the documentation of this file.
1 /***************************************************************************
2  draw.h - simplistic drawing module
3  -------------------
4  begin : Sun Dec 21 2003
5  version : 0.1
6  copyright : (C) 2003 by Albert Diosi and Lindsay Kleeman
7  email : albert.diosi@gmail.com
8  change: -14/03/2005 rewriting to use only X, instead of libplot
9  -25/01/2005 dr_cov_ellipse added
10  -8/11/2004 dr_zoom added
11  ***************************************************************************/
12 /****************************************************************************
13 Copyright (c) 2003-2015, Albert Diosi and Lindsay Kleeman
14 All rights reserved.
15 
16 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
17 
18  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
19  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
20  * The name of the copyright holders may not be used to endorse or promote products derived from this software without specific prior written permission.
21 
22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 ****************************************************************************/
24 
25 
26 #ifndef _DRAW_
27 #define _DRAW_
28 extern "C" char* dr_COLORS[];
29 extern "C" int dr_COLORS_CNT;
30 
31 extern "C" void dr_init(int screen_x_max,int screen_y_max,double xmin, double ymin, double xmax, double ymax);
32 extern "C" void dr_close(void);
33 extern "C" void dr_line(double x1, double y1, double x2, double y2,const char *color);
34 extern "C" void dr_marker(double x, double y, int type,const char *color);
35 extern "C" void dr_text(double x, double y, int hz_al,int vr_al,const char *text, const char* color);
36 extern "C" void dr_text_pix(int px, int py,const char *text, const char* color);
37 extern "C" void dr_scale(double xmin, double ymin, double xmax, double ymax);
38 extern "C" void dr_replot(void);
39 extern "C" void dr_erase(void);
40 extern "C" void dr_circle(double x, double y, double r,const char *color);
41 extern "C" void dr_cov_ellipse(double x, double y, double c11,double c12,double c22,const char *color);
42 extern "C" void dr_zoom(void);
43 extern "C" void dr_fit(void);
44 extern "C" void dr_save(const char *filename);
45 extern "C" void dr_equal(int equal);
46 extern "C" void dr_print_database(void);
47 #endif
48 
49 
void dr_replot(void)
Redraw the screen content.
Definition: draw.c:646
void dr_text_pix(int px, int py, const char *text, const char *color)
Temporary code to output text to screen coordinates.
Definition: draw.c:633
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.
Definition: draw.c:437
void dr_equal(int equal)
Enable or disable equal drawing unit per pixel ratio for both axis.
Definition: draw.c:897
void dr_circle(double x, double y, double r, const char *color)
Plot a circle of radius r at [x,y] using color.
Definition: draw.c:468
int dr_COLORS_CNT
Definition: draw.h:29
char * dr_COLORS[]
Definition: draw.h:28
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).
Definition: draw.c:602
void dr_save(const char *filename)
Save the screen into a PNG image (needs extra packages).
Definition: draw.c:883
void dr_init(int screen_x_max, int screen_y_max, double xmin, double ymin, double xmax, double ymax)
Initialize the drawing module.
Definition: draw.c:321
void dr_fit(void)
Scale all drawn objects to fit the screen.
Definition: draw.c:804
void dr_erase(void)
Clear the screen and erase the drawn objects from memory.
Definition: draw.c:682
void dr_close(void)
Close the drawing window.
Definition: draw.c:351
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.
Definition: draw.c:572
void dr_cov_ellipse(double x, double y, double c11, double c12, double c22, const char *color)
Plot a covariance ellipse to depict uncertainty.
Definition: draw.c:504
void dr_zoom(void)
Interactive zooming until enter, space or 'q' is pressed.
Definition: draw.c:702
void dr_print_database(void)
Debug function to print buffer.
Definition: draw.c:906
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.
Definition: draw.c:672