plot.h
Go to the documentation of this file.
1 #ifndef PLOTH
2 #define PLOTH
3 
4 #include <stdio.h>
5 
20 /************************************************************************************/
27 #define SOLID_LINE 0
28 
35 #define DASHED_LINE 1
36 
43 #define DOTTED_LINE 2
44 /************************************************************************************/
45 
51 typedef struct {
52  FILE *f;
53  double offset_x;
54  double offset_y;
55  unsigned int line_style;
56  unsigned int line_width;
57  int fill_color;
58  int pen_color;
60  int depth;
62 } Tplot;
63 
72 void InitPlot(const char *name,Tplot *p);
73 
83 void SetLineWidth(unsigned int width,Tplot *p);
95 void SetLineStyle(unsigned int style,Tplot *p);
106 void SetOrigin(double offset_x,double offset_y,Tplot *p);
123 void SetPenColor(int color,Tplot *p);
140 void SetFillColor(int color,Tplot *p);
141 
152 void SetFillIntensity(unsigned int intensity,Tplot *p);
162 void SetDepth(unsigned int depth,Tplot *p);
163 
174 void PlotCircle(double cx,double cy,double r,Tplot *p);
186 void PlotRectangle(double x_left,double y_sup,double x_right,double y_inf,Tplot *p);
200 void PlotTriangle(double x1,double y1,double x2,double y2,double x3,double y3,Tplot *p);
201 
213 void PlotLine(double x0,double y0,double x1,double y1,Tplot *p);
225 void PlotArrow(double x0,double y0,double x1,double y1,Tplot *p);
236 void PlotText(double x,double y,const char *text,Tplot *p);
251 void PlotAxis(const char *nx,double min_x,double max_x,
252  const char *ny,double min_y,double max_y,
253  double step,
254  Tplot *p);
255 
264 void ClosePlot(Tplot *p);
265 
266 #endif
unsigned int line_width
Definition: plot.h:56
void SetFillIntensity(unsigned int intensity, Tplot *p)
Changes the current fill intensity.
Definition: plot.c:134
int pen_color
Definition: plot.h:58
void InitPlot(const char *name, Tplot *p)
Constructor.
Definition: plot.c:60
A 2D plot.
Definition: plot.h:51
void SetOrigin(double offset_x, double offset_y, Tplot *p)
Changes the current origin of the plot.
Definition: plot.c:116
int fill_intensity
Definition: plot.h:59
void PlotLine(double x0, double y0, double x1, double y1, Tplot *p)
Plots a segment.
Definition: plot.c:215
unsigned int line_style
Definition: plot.h:55
void SetPenColor(int color, Tplot *p)
Changes the current pen color.
Definition: plot.c:122
double offset_y
Definition: plot.h:54
void SetLineWidth(unsigned int width, Tplot *p)
Changes the current line width.
Definition: plot.c:97
void PlotText(double x, double y, const char *text, Tplot *p)
Plots a text.
Definition: plot.c:239
void SetLineStyle(unsigned int style, Tplot *p)
Changes the current line stype.
Definition: plot.c:105
void SetDepth(unsigned int depth, Tplot *p)
Changes the current plot depth.
Definition: plot.c:141
void PlotTriangle(double x1, double y1, double x2, double y2, double x3, double y3, Tplot *p)
Plots a triangle.
Definition: plot.c:194
void ClosePlot(Tplot *p)
Destructor.
Definition: plot.c:275
void PlotArrow(double x0, double y0, double x1, double y1, Tplot *p)
Plots a segment with an arrow.
Definition: plot.c:227
void PlotAxis(const char *nx, double min_x, double max_x, const char *ny, double min_y, double max_y, double step, Tplot *p)
Plots a X-Y axis.
Definition: plot.c:247
double offset_x
Definition: plot.h:53
void PlotCircle(double cx, double cy, double r, Tplot *p)
Plots a circle.
Definition: plot.c:149
void PlotRectangle(double x_left, double y_sup, double x_right, double y_inf, Tplot *p)
Plots a rectangle.
Definition: plot.c:165
void SetFillColor(int color, Tplot *p)
Changes the current fill color.
Definition: plot.c:128
FILE * f
Definition: plot.h:52
int depth
Definition: plot.h:60
int fill_color
Definition: plot.h:57