Originally Posted by atl77
It is not limited in amount of coords, it is just that the x/y coordinates on the grid are limited to 0-99, because that is actually the case. The corresponding code is this:
Code:
for ($c = 0; $c < count($coords); $c++) { ...
This takes all coordinates, not only the first 100.
|
Yep, thats my bad, i didnt saw that.
But here's an idea: you could pre-filter the coords - those that rounded amount to the same point doesn't need to run through the bresenham algorithm once more - this could improve the speed on those objective with more than 1000 points:
Code:
function coords2grid($coords, $radius = 5, $shrink) {
$grid = newgrid();
$points = newgrid();
for ($c = 0; $c < count($coords); $c++) {
$cx = round($coords[$c]['x']);
$cy = round($coords[$c]['y']);
if ($points[$cx][$cy] == 1) { continue; }
$points[$cx][$cy] = 1;
$rx = $radius;
$ry = 0;
$rerr = $radius;
...
|
If u have time u can write me such rounding function in PHP, couse i have problem with objectives order which i have to handle first.
^^ Never mind I have already written it myself!