X-Git-Url: http://git.maemo.org/git/?p=scdataviz;a=blobdiff_plain;f=graph.h;h=68aa97bb2bae94dc6b6367b83b0cae881c120f42;hp=3015d30288e215f14655242cf6a56eefee0dcfb3;hb=2329e96577a27c47e5287118d8808542fbed12ec;hpb=055d5e52306ce386a0ddfa98920e78242db1a2b4 diff --git a/graph.h b/graph.h index 3015d30..68aa97b 100644 --- a/graph.h +++ b/graph.h @@ -35,19 +35,28 @@ struct graph_point { double x; double y; GString *label; - /*the Bezier control point FROM HERE to the next point (P1)*/ - double bezier_from_x; - double bezier_from_y; - /*the Bezier control point from previous point TO HERE (P2)*/ - double bezier_to_x; - double bezier_to_y; +}; + +/*Bezier line*/ +struct graph_line { + /*First point*/ + double p0_x; + double p0_y; + /*Control pts*/ + double p1_x; + double p1_y; + double p2_x; + double p2_y; + /*End point*/ + double p3_x; + double p3_y; }; typedef struct _Graph { GObject parent_instance; /*Array of n_points sets of x,y coords*/ GPtrArray *points; - /*If you want to, this will override the lines between the points.*/ + /*This draws all of the lines (generally between points)*/ GPtrArray *lines; double maxx; double minx; @@ -70,5 +79,13 @@ typedef struct _GraphClass { Graph *graph_new(void); int graph_add_point(Graph* graph, double x, double y, const GString *label); int graph_add_graph_point(Graph* graph, struct graph_point *pt); +int graph_add_line(Graph* graph, double p0_x, double p0_y, double p1_x, double p1_y, double p2_x, double p2_y, double p3_x, double p3_y); +void graph_add_linear_connectors(Graph* graph); +/*Provide x0, x3; x1 and x2 will be set*/ +void graph_bezier_linear_to_cubic(double x0, double x3, double *x1, double *x2); +/*Provide x0, x1, x2. x1 and x2 will be set appropriately.*/ +void graph_bezier_qudratic_to_cubic(double x0, double x3, double *x1, double *x2); + + #endif /* !GRAPHCLASS_H_ */