Difference between revisions of "User talk:Chase-san/Kd-Tree"

From Robowiki
Jump to navigation Jump to search
(NullPointerExceptions and inaccuracy)
 
(weird)
Line 5: Line 5:
 
if(p != null && k.distanceSq(p) < t) {
 
if(p != null && k.distanceSq(p) < t) {
 
</pre>Something else is wrong also I believe, because it's only getting "88% accuracy" out of the benchmark results, so it's not finding all of the nearest neighbors correctly. --[[User:Rednaxela|Rednaxela]] 22:23, 1 March 2010 (UTC)
 
</pre>Something else is wrong also I believe, because it's only getting "88% accuracy" out of the benchmark results, so it's not finding all of the nearest neighbors correctly. --[[User:Rednaxela|Rednaxela]] 22:23, 1 March 2010 (UTC)
 +
:That should only happen if the rectangle hasn't gotten expanded ever, which shouldn't happen, unless you haven't added anything to the tree at all (darn me and removing all my safeties). Since this gets set during the add. Can you give me some idea of the data you are feeding into it? --[[User:Chase-san|Chase]] 22:44, 1 March 2010 (UTC)

Revision as of 23:44, 1 March 2010

NullPointerExceptions and inaccuracy

Trying to test your Kd-Tree in the benchmark framework, I'm getting some NullPointerExceptions due to right.rect.getNearest(k) returning null sometimes. I don't know if it's the proper fix, I changed the relevant lines to be like:

PointKD p = right.rect.getNearest(k);
if(p != null && k.distanceSq(p) < t) {

Something else is wrong also I believe, because it's only getting "88% accuracy" out of the benchmark results, so it's not finding all of the nearest neighbors correctly. --Rednaxela 22:23, 1 March 2010 (UTC)

That should only happen if the rectangle hasn't gotten expanded ever, which shouldn't happen, unless you haven't added anything to the tree at all (darn me and removing all my safeties). Since this gets set during the add. Can you give me some idea of the data you are feeding into it? --Chase 22:44, 1 March 2010 (UTC)