
wusste garnicht, dass da auch ein $this hinmuss.
Dankesschön, jetzt gehts und ich hab wieder was dazugelernt :P

function drawLine($i)
{
$this->beforeY = $this->computeY(scaleX(--$i));
$this->nowY = $this->computeY(scaleX($i));
imageline($graph,--$i,$this->beforeY,$i,$this->nowY,$lines);
}


class valueOfY
{
var $funktion;
var $height;
var $width;
var $rasterSize;
function scaleX($i)
{
if($i<=($this->width/2))
$this->scaledX = -($this->width/2-$i)/$this->rasterSize;
elseif($i>($this->width/2))
$this->scaledX = ($i-$this->width/2)/$this->rasterSize;
return $this->scaledX;
}
function computeY($x)
{
if($x == 0)
$x = 1;
$this->newFunktion = str_replace('x',$x,$this->funktion);
$this->absoluteY = eval('return '.$this->newFunktion.';');
$this->relativeY = ($this->height/2)-($this->absoluteY*$this->rasterSize);
return $this->relativeY;
}
function drawLine($i)
{
$this->beforeY = computeY(scaleX(--$i));
$this->nowY = computeY(scaleX($i));
imageline($graph,--$i,$this->beforeY,$i,$this->nowY,$lines);
}
}
$term = new valueOfY();
$term->funktion = $value;
$term->height = $height;
$term->width = $width;
$term->rasterSize = $rasterSize;
$term->drawline($i);
Einen Kommentar schreiben: