onedumbcoder Posted September 1, 2009 Share Posted September 1, 2009 I been trying to figure this out and i am just to stupid to get it. :'( how do i echo out the x and y value as i go around a circle? lets say the radius of a circle is 10, and I go around the circle at 10 degree increments, how do I echo out what each y and x values are? Quote Link to comment https://forums.phpfreaks.com/topic/172646-echoing-out-all-the-coordinates-of-a-circle-warninggenius-needed/ Share on other sites More sharing options...
benyhanna Posted September 1, 2009 Share Posted September 1, 2009 Why don't you go brush up on your geometry skills instead of having someone do your work for you? Quote Link to comment https://forums.phpfreaks.com/topic/172646-echoing-out-all-the-coordinates-of-a-circle-warninggenius-needed/#findComment-910028 Share on other sites More sharing options...
MadTechie Posted September 1, 2009 Share Posted September 1, 2009 Personally after reading [WARNING:Genius needed] I wasn't going to reply as I find post that are labelled like this are only done so to get a quicker response, hence I intentionally ignore them, for awhile, however I decided to have some fun, and relive some old school coding, of drawing remove the GD stuff and uncomment the echo for the function you need (also for each 10th degrees your need 36 side (360 / 10) <?php header("Content-type: image/png"); drawCircle(100, 100, 50, 100); function drawCircle($centerX, $centerY, $radius, $sides){ $im = @imagecreate(500, 500) or die("Cannot Initialize new GD image stream"); $background_color = imagecolorallocate($im, 255, 255, 255); $color = imagecolorallocate($im, 0, 0, 0); for($i=0; $i<=$sides; $i++) { $pointRatio = $i/$sides; $xSteps = cos($pointRatio*2*pi()); $ySteps = sin($pointRatio*2*pi()); $pointX = $centerX + $xSteps * $radius; $pointY = $centerY + $ySteps * $radius; // echo "$pointX, $pointY\n"; imageellipse($im, $pointX, $pointY, 1, 1, $color); } imagepng($im); imagedestroy($im); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/172646-echoing-out-all-the-coordinates-of-a-circle-warninggenius-needed/#findComment-910034 Share on other sites More sharing options...
corbin Posted September 1, 2009 Share Posted September 1, 2009 Basic trig and some algebraic geometry? A genius? I think some advanced 7th graders could do that x.x. Quote Link to comment https://forums.phpfreaks.com/topic/172646-echoing-out-all-the-coordinates-of-a-circle-warninggenius-needed/#findComment-910040 Share on other sites More sharing options...
MadTechie Posted September 1, 2009 Share Posted September 1, 2009 Great just over 11 minutes, that's how long my genius dream lasted thanks corbin Yeah I know, as I said the subject is just to get people to view it, I think drawing a circle was one of the first programs I ever created. I found it a little iconic I used the imageellipse() function to draw the dots of a circle Quote Link to comment https://forums.phpfreaks.com/topic/172646-echoing-out-all-the-coordinates-of-a-circle-warninggenius-needed/#findComment-910046 Share on other sites More sharing options...
corbin Posted September 2, 2009 Share Posted September 2, 2009 That is a bit ironic. And yeah, I knew the WARNING was just to get attention. I was mainly mocking the OP's putting that. Quote Link to comment https://forums.phpfreaks.com/topic/172646-echoing-out-all-the-coordinates-of-a-circle-warninggenius-needed/#findComment-910700 Share on other sites More sharing options...
Philip Posted September 2, 2009 Share Posted September 2, 2009 $5 says CV reads this thread just because it asks for a genius. Quote Link to comment https://forums.phpfreaks.com/topic/172646-echoing-out-all-the-coordinates-of-a-circle-warninggenius-needed/#findComment-910703 Share on other sites More sharing options...
corbin Posted September 2, 2009 Share Posted September 2, 2009 Eh, it'll probably fall down before he sees it . Quote Link to comment https://forums.phpfreaks.com/topic/172646-echoing-out-all-the-coordinates-of-a-circle-warninggenius-needed/#findComment-910712 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.