osetrit nan
This commit is contained in:
parent
30e1165d78
commit
474180e790
18
ps_graph.c
18
ps_graph.c
@ -39,8 +39,8 @@ void ps_export_graph(FILE *file, struct expr_node *node, struct graph_range *ran
|
|||||||
|
|
||||||
for (i = -HALF_GRAPH_SIZE; i <= HALF_GRAPH_SIZE; i += GRID_STEP) {
|
for (i = -HALF_GRAPH_SIZE; i <= HALF_GRAPH_SIZE; i += GRID_STEP) {
|
||||||
double inorm = (double)i / (double)GRAPH_SIZE + 0.5;
|
double inorm = (double)i / (double)GRAPH_SIZE + 0.5;
|
||||||
double xval = range->xmax * inorm + range->xmin * (1.0 - inorm) ; // range->xmin + inorm * (range->xmax - range->xmin);
|
double xval = range->xmax * inorm + range->xmin * (1.0 - inorm);
|
||||||
double yval = range->ymax * inorm + range->ymin * (1.0 - inorm) ; // range->xmin + inorm * (range->xmax - range->xmin);
|
double yval = range->ymax * inorm + range->ymin * (1.0 - inorm);
|
||||||
|
|
||||||
fprintf(file,
|
fprintf(file,
|
||||||
"newpath\n"
|
"newpath\n"
|
||||||
@ -88,10 +88,18 @@ void ps_export_graph(FILE *file, struct expr_node *node, struct graph_range *ran
|
|||||||
);
|
);
|
||||||
|
|
||||||
for (x = range->xmin; x <= range->xmax; x += range->step) {
|
for (x = range->xmin; x <= range->xmax; x += range->step) {
|
||||||
|
const char *cmd = "lineto";
|
||||||
|
double xpos, ypos;
|
||||||
double y = node_eval(node, x);
|
double y = node_eval(node, x);
|
||||||
double xpos = (double)(-HALF_GRAPH_SIZE) + (x - range->xmin) / (range->xmax - range->xmin) * (double)GRAPH_SIZE;
|
|
||||||
double ypos = (double)(-HALF_GRAPH_SIZE) + (y - range->ymin) / (range->ymax - range->ymin) * (double)GRAPH_SIZE;
|
if (y != y) {
|
||||||
const char* cmd = "lineto";
|
first = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
xpos = (double)(-HALF_GRAPH_SIZE) + (x - range->xmin) / (range->xmax - range->xmin) * (double)GRAPH_SIZE;
|
||||||
|
ypos = (double)(-HALF_GRAPH_SIZE) + (y - range->ymin) / (range->ymax - range->ymin) * (double)GRAPH_SIZE;
|
||||||
|
|
||||||
if (first) {
|
if (first) {
|
||||||
cmd = "moveto";
|
cmd = "moveto";
|
||||||
first = 0;
|
first = 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user