Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
just to synchronize better
  • Loading branch information
laa11004 committed Dec 7, 2015
1 parent 39925cb commit b908749
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
9 changes: 4 additions & 5 deletions kdtest/Menu.pde
Expand Up @@ -16,8 +16,8 @@ class Menu{

int onaButton(int x, int y){
int i;
for( i = 0; i < 4; i++){
if(_buttonList.get(i).isInside(x,y)) { return i; }
for( i = 0; i < 4; i++){ //loop checks if any button was clicked
if(_buttonList.get(i).isInside(x,y)) { return i; } //and returns the _id if one was in fact clicked
}
return 99;
}
Expand All @@ -30,9 +30,8 @@ class Menu{
}

void mousePressed(){
int button = onaButton(mouseX,mouseY);
println("%d \n",button);
if( button != 99 ){ activate(button); } //99 is an arbitrary invalid _id value
int button = onaButton(mouseX,mouseY); //which button is selected
if( button != 99 ){ activate(button); } //99 is an arbitrary invalid button _id
else{ _selector.mousePressed(); }
}

Expand Down
5 changes: 4 additions & 1 deletion kdtest/Selector.pde
Expand Up @@ -43,7 +43,10 @@ class Selector{
case 0:
Point p1 = cam.transform(new Point(_startX, _startY));
Point p2 = cam.transform(new Point(_endX, _endY));
//pot._tree.query(new BoundingBox(p1._x, p1._y, p2._x, p2._y));
if(pot.getTree() != null){//prevents query of null/empty tree
ArrayList<Point> solution = pot.getTree().query(new BoundingBox(p1._x, p1._y, p2._x, p2._y));
println("size of list: %d", solution.size());
}
break;
case 1: //_tree.circleQuery(cam.transform(new Point(_a,_b)),
}
Expand Down
3 changes: 2 additions & 1 deletion kdtest/Tests.pde
Expand Up @@ -23,9 +23,10 @@ boolean inBox(Point p, BoundingBox a)
{
return p._x >= a.x1 && p._x <= a.x2 && p._y >= a.y1 && p._y <= a.y2;
}

//random helper function I don't know where to put
ArrayList<Point> merge(ArrayList<Point> a, ArrayList<Point> b) {
for(Point p : b)
a.add(p);
return a;
}
}
1 change: 1 addition & 0 deletions kdtest/Tree.pde
Expand Up @@ -170,6 +170,7 @@ class TreeContainer {
}

KdTree getTree(){ return _tree;}

void clearTree(){ _tree = null; }

void draw(){ _tree.draw(); }
Expand Down
2 changes: 2 additions & 0 deletions kdtest/kdtest.pde
Expand Up @@ -4,6 +4,7 @@ Mode statusLine;
//KdTree tree;
TreeContainer pot;//or tree
Menu menu;
Point nearestNeighbor;

ArrayList<Point> pointList;

Expand All @@ -25,6 +26,7 @@ void setup() {
cam = new Camera();
statusLine = new Mode();
pot = new TreeContainer();
nearestNeighbor = null;

pointList = new ArrayList<Point>();
//tree = null;
Expand Down

0 comments on commit b908749

Please sign in to comment.