Thread: WOD/Pre-patch
View Single Post
12-10-14, 05:45 AM   #729
ircdirk
A Molten Giant
 
ircdirk's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2014
Posts: 823
Originally Posted by atl77 View Post
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!

Last edited by ircdirk : 12-10-14 at 06:06 AM.