Michdd Posted August 21, 2009 Share Posted August 21, 2009 I've never done something like this specifically, but I have done a lot of other PHP math.. and I can't seem to figure this logic out. I'll have a certain number of items and I'll need to place this in a circle spaced evenly apart, I'll be using PHP GD, and I just need help getting a good concept of how to generate the coords for each item. Link to comment https://forums.phpfreaks.com/topic/171254-solved-getting-coordinates-for-a-circle/ Share on other sites More sharing options...
Michdd Posted August 21, 2009 Author Share Posted August 21, 2009 Solution example: $r = 20; $intervals = 3; $delta_theta = 2.0 * pi() / $intervals; $theta = 0; for($i = 0; $i < $intervals;$i++) { echo "(" . $r * cos($theta) . ", " . $r * sin($theta) . ")"; $theta += $delta_theta; } Link to comment https://forums.phpfreaks.com/topic/171254-solved-getting-coordinates-for-a-circle/#findComment-903083 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.