diff options
author | hanemile <hanemile@protonmail.com> | 2018-11-03 00:48:26 +0100 |
---|---|---|
committer | hanemile <hanemile@protonmail.com> | 2018-11-03 00:48:26 +0100 |
commit | 62b9bd50e785f52e2692624ffc04299e731048b7 (patch) | |
tree | 0120009db795a0e9775f52fdb7f1a13b763597b7 | |
parent | 91003487acda056be18c9efecedd951ca9629f26 (diff) |
Implemented a reccursive print function for a quadtree.
-rw-r--r-- | structs.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/structs.go b/structs.go index 68ccea3..38ed84c 100644 --- a/structs.go +++ b/structs.go @@ -151,3 +151,19 @@ func (quadtree *quadtree) Insert(point Coord) { // Insert the point into the slice quadtree.pointsSlice = append(quadtree.pointsSlice, point) } + +func (quadtree *quadtree) Print() { + if quadtree.northEast != nil { + quadtree.northEast.Print() + } + if quadtree.northWest != nil { + quadtree.northWest.Print() + } + if quadtree.southEast != nil { + quadtree.southEast.Print() + } + if quadtree.southWest != nil { + quadtree.southWest.Print() + } + print(quadtree.pointsSlice) +} |