This will store the derived point in the quadtree, rather than the input data. This is tricky. You need the computed *x* and *y* location of the node to insert new nodes, but the node’s *point* should refer to the input data, not the derived point. I think you could fix this by storing the computed *x* and *y* on the node directly (as `n.x` and `n.y` rather than `n.point.x` and `n.point.y`).

You could also change the signature of insert to insert(n, d, x, y, x1, y1, x2, y2), where *d* is the datum and *x* and *y* are its location. The cool thing about that is what you could represent the computed points more efficiently as two parallel arrays of x- and y-coordinates, rather than creating point objects (since you don't ever need to save the derived point objects).