#include #include #define PI 3.141592653 #include "gragl.h" Scalar sin_scalar(double x) { Scalar y = { .v = sin(x), .valid = 1 }; return y; } Scalar cos_scalar(double x) { Scalar y = { .v = cos(x), .valid = 1 }; return y; } Scalar tan_scalar(double x) { Scalar y = { .v = tan(x), .valid = 1 }; return y; } Scalar sincos_scalar(double x) { Scalar y = { .v = sin(x) * cos(x) * cos(x) * cos(x) * x, .valid = 1 }; return y; } 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); plot(group); free_plot2d_group(group); return 0; }