-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
Removing and searching points does not work properly. I think the problem is that the width and height of the rectangle for points is 0. For example the rectangle used to insert the point (1 1) is: {x: 1, y: 1, w: 0, h: 0}
<html>
<head>
<script src="RTree/src/rtree.js"></script>
<script type="text/javascript">
var rtee;
function init() {
rtree = new RTree();
var point1 = { 'id': 1,
'bounds': {x: 10, y: 5, w: 0, h: 0}};
var point2 = { 'id': 2,
'bounds': {x: 6, y: 7, w: 0, h: 0}};
rtree.insert(point1.bounds, point1);
rtree.insert(point2.bounds, point2);
var removedCount = rtree.remove(point1.bounds, point1);
console.log(removedCount); // output: []
removedCount = rtree.remove({x: 9.5, y: 4.5, w: 1, h: 1}, point1);
console.log(removedCount); // output: [Object] (leaf containing point1)
var objects = rtree.search({x:6, y: 7, w: 1, h: 1});
console.log(objects); // output: []
objects = rtree.search({x:5.5, y: 6.5, w: 1, h: 1});
console.log(objects[0]); // output: Object (point2)
}
</script>
</head>
<body onload="init()">
</body>
</html>
Metadata
Metadata
Assignees
Labels
No labels