/****************************************************************************/ /* (C) Copyright 1993 Universidade Estadual de Campinas (UNICAMP) */ /* Campinas, SP, Brazil */ /* */ /* This file can be freely distributed, modified, and used for any */ /* non-commercial purpose, provided that this copyright and authorship */ /* notice be included in any copy or derived version of this file. */ /* */ /* DISCLAIMER: This software is offered ``as is'', without any guarantee */ /* as to fitness for any particular purpose. Neither the copyright */ /* holder nor the authors or their employers can be held responsible for */ /* any damages that may result from its use. */ /****************************************************************************/ /* See fltgraph.h */ #include "fltgraph.h" #include #include #include #include #include #include void fltgraph_plot( FILE *psfile, Float f (Float x), Interval xd, Interval yd, int m ) { int xi; Float x0, y0, x1, y1; ROUND_NEAR; ps_begin_section(psfile, "Plot of actual graph"); ps_set_pen(psfile, 0.0, 0.30, 0.0, 0.0); x1 = xd.lo; y1 = f(x1); for (xi=0; xi= yd.lo) || (y1 >= yd.lo)) ) { ps_draw_segment(psfile, x0, y0, x1, y1); } } ps_end_section(psfile); } void fltgraph_draw_axes( FILE *psfile, Interval xd, Interval yd ) { if ((xd.lo < Zero) && (xd.hi > Zero)) { ps_draw_coord_line(psfile, 'x', 0.0); } if ((yd.lo < Zero) && (yd.hi > Zero)) { ps_draw_coord_line(psfile, 'y', 0.0); } }