Beispiel #1
0
     $x_arr = array();
     $m = sizeof($xvalues);
     $empty = true;
     for ($i = 0; $i < $m; $i += 1) {
         $x = $xvalues[$i];
         if ($x >= $x_first && $x <= $x_last) {
             if ($empty && $x > $x_first) {
                 array_push($x_arr, $x_first);
             }
             array_push($x_arr, $x);
             $empty = false;
         }
     }
     $xvalues = $x_arr;
     if (sizeof($xvalues) > 0) {
         $yvalues = $spline->calc_array($xvalues);
     } else {
         $yvalues = array();
     }
     //exit('{status:"stuff",data:[],x:'.json_encode($xvalues).',y:'.json_encode($yvalues).',pnt:'.json_encode($points).'}');
 } else {
     $expr = new Expression();
     $expr->parse($expr_str);
     $yvalues = $expr->eval_double_array(array(), 'x', $xvalues);
 }
 $m = sizeof($xvalues);
 if ($m == 0) {
     exit('{status:"OK?",data:[]}');
 }
 if ($m != sizeof($yvalues)) {
     exit('{status:"error",value:"X-Y mismatch"}');