Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
use GD::Simple;
$i = GD::Simple->new(400,400);
($x1,$y1) = (0,0);
for ($x2=0; $x2<=400; $x2+=10) {
$y2 = sin($x2)*400;
$i->moveTo($x1,$y1);
$i->lineTo($x2,$y2);
($x1,$y1) = ($x2,$y2);
}
print $i->png;
How do I get right value for y2? Thank.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Make sin wave with GD
by pme (Monsignor) on Jul 01, 2015 at 17:05 UTC | |
by Anonymous Monk on Jul 01, 2015 at 17:12 UTC | |
by pme (Monsignor) on Jul 01, 2015 at 17:25 UTC | |
by Anonymous Monk on Jul 01, 2015 at 17:40 UTC | |
by sn1987a (Curate) on Jul 01, 2015 at 18:14 UTC | |
|