Skip to content

Commit 6e00dec

Browse files
committedOct 11, 2014
- Removed floor in 'subdivide' function. When trying to build quadtrees in applications with high precision (a google map's lat/lng measurements, for instance), this was causing the quadtree to never create more than one subdivision or point, unless, of course, the points were far enough apart to pass the bitshift operation intact
1 parent bb5d718 commit 6e00dec

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎JavaScript/QuadTree/src/QuadTree.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@
219219
var by = this._bounds.y;
220220

221221
//floor the values
222-
var b_w_h = (this._bounds.width / 2) | 0; //todo: Math.floor?
223-
var b_h_h = (this._bounds.height / 2) | 0;
222+
var b_w_h = (this._bounds.width / 2); //todo: Math.floor?
223+
var b_h_h = (this._bounds.height / 2);
224224
var bx_b_w_h = bx + b_w_h;
225225
var by_b_h_h = by + b_h_h;
226226

0 commit comments

Comments
 (0)