Created
July 9, 2012 05:13
-
-
Save anonymous/3074329 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from point_class import Point | |
| from quad_tree_class import QuadTree | |
| import pprint | |
| import sys | |
| pt1 = Point(0,0) | |
| pt2 = Point(1,1) | |
| pt3 = Point(-1,-1) | |
| pt4 = Point(1,-1) | |
| pt5 = Point(-1,1) | |
| def printPoints(pts): | |
| for pt in pts: | |
| print pt | |
| def printTree(tree): | |
| print tree | |
| print tree.SE | |
| print tree.SW | |
| print tree.NE | |
| print tree.NW | |
| #printPoints([pt1,pt2,pt3]) | |
| qt = QuadTree(pt1) | |
| #printTree(qt) | |
| # if qt.find(pt1): | |
| # printTree(qt) | |
| try: | |
| qt.insert(pt2) | |
| except: | |
| "That point already exists in the tree. Try harder." | |
| try: | |
| qt.insert(pt3) | |
| except: | |
| "That point already exists in the tree. Try harder." | |
| try: | |
| qt.insert(pt4) | |
| except: | |
| "That point already exists in the tree. Try harder." | |
| try: | |
| qt.insert(pt5) | |
| except: | |
| "That point already exists in the tree. Try harder." | |
| print qt | |
| # try: | |
| # insert = qt.Insert(pt3) | |
| # except: | |
| # print "That point is in the tree" | |
| # sys.exit(0) | |
| # print insert | |
| # printTree(qt) | |
| #print insert |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment