ubilabs / kd-tree-javascript

JavaScript k-d Tree Implementation
MIT License
642 stars 109 forks source link

bug!bug!bug! #42

Open MrYang614 opened 10 months ago

MrYang614 commented 10 months ago

const points = [{ 'y': 2, 'x': 110 }, { 'y': 2, 'x': 222 }, { 'y': 2, 'x': 333 }, { 'y': 2, 'x': 444 }, { 'y': 2, 'x': 555 }, { 'y': 2, 'x': 666 }, { 'y': 2, 'x': 777 }, { 'y': 2, 'x': 888 }, { 'y': 2, 'x': 999 }, { 'y': 2, 'x': 1110 }]

R = 1000

            const tree = new kdTree([...points], distance, ["x", "z"]);

            const obj = {};

                const nearest = tree.nearest(points[0], 10, R);

// const nearest = tree.nearest(point[points.length-1],10,R)

In a line points , the first point and the last point , get the error data