From 87a70d198b1361b6c9601e61fef6b58071bbd0a8 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Thu, 9 Nov 2023 02:17:39 +0100 Subject: add interactivity and shared lib --- example.c | 43 ++++++++++++++++++------------------------- 1 file changed, 18 insertions(+), 25 deletions(-) (limited to 'example.c') diff --git a/example.c b/example.c index af16110..ca9afa2 100644 --- a/example.c +++ b/example.c @@ -42,31 +42,24 @@ Scalar sincos_scalar(double x) { } int main() { - Plot2d sin_plot; - sin_plot.func = sin_scalar; - sin_plot.from = -1; - sin_plot.to = 5; - sin_plot.step = 0.001; - - Plot2d cos_plot; - cos_plot.func = cos_scalar; - cos_plot.from = -1; - cos_plot.to = 5; - cos_plot.step = 0.001; - - Plot2d tan_plot; - tan_plot.func = tan_scalar; - tan_plot.from = -1; - tan_plot.to = 5; - tan_plot.step = 0.001; - - Plot2d sincos_plot; - sincos_plot.func = sincos_scalar; - sincos_plot.from = 0; - sincos_plot.to = 100; - sincos_plot.step = 0.01; - - Plot2dGroup * group = create_plot2d_group(4, sin_plot, cos_plot, tan_plot, sincos_plot); + Function group1[] = { + FUNC_AUTO(sin_scalar), + FUNC_AUTO(cos_scalar), + }; + + Function group2[] = { + FUNC_AUTO(tan_scalar), + }; + + Function group3[] = { + FUNC_AUTO(sincos_scalar), + }; + + Plot2d plot1 = PLOT_AUTO(group1); + Plot2d plot2 = PLOT_AUTO(group2); + Plot2d plot3 = PLOT_AUTO(group3); + + Plot2dGroup * group = create_plot2d_group(4, plot1, plot2, plot3); plot(group); free_plot2d_group(group); -- cgit v1.2.3-70-g09d2