From 62b9bd50e785f52e2692624ffc04299e731048b7 Mon Sep 17 00:00:00 2001 From: hanemile Date: Sat, 3 Nov 2018 00:48:26 +0100 Subject: Implemented a reccursive print function for a quadtree. --- structs.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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) +} -- cgit 1.4.1