note 96776 added to function.sin

From: Date: Mon, 15 Mar 2010 21:26:05 +0000
Subject: note 96776 added to function.sin
Groups: php.notes 
Request: Send a blank email to php-notes+get-167074@lists.php.net to get a copy of this message
You can use SIN & COS to create/draw circles. Please beware that the circle's center is also your base point (0,0). So without specifying an offset, some coordinates will be negative. <?php $circleRadius = 70; $offsetX = 100; $offsetY = 100; for($i = 0; $i <= 360; ++$i) { $x = round(cos($i * M_PI / 180) * $circleRadius); $y = round(sin($i * M_PI / 180) * $circleRadius); // Draw some pixel, or do something else here. imagesetpixel($GDimage, $x + $offsetX, $y + $offsetY, $GDcolor); } ?> ---- Server IP: 91.199.167.223 Probable Submitter: 83.87.181.228 ---- Manual Page -- http://www.php.net/manual/en/function.sin.php Edit -- https://master.php.net/note/edit/96776 Del: integrated -- https://master.php.net/note/delete/96776/integrated Del: useless -- https://master.php.net/note/delete/96776/useless Del: bad code -- https://master.php.net/note/delete/96776/bad+code Del: spam -- https://master.php.net/note/delete/96776/spam Del: non-english -- https://master.php.net/note/delete/96776/non-english Del: in docs -- https://master.php.net/note/delete/96776/in+docs Del: other reasons-- https://master.php.net/note/delete/96776 Reject -- https://master.php.net/note/reject/96776 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#167074) next »