From e153a00a6031cc52e5f69c2b76d56ebd438af267 Mon Sep 17 00:00:00 2001 From: hanemile Date: Sat, 3 Nov 2018 17:53:11 +0100 Subject: moved the quadtree to the top of the file --- structs.go | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/structs.go b/structs.go index 8689c7a..fa503ec 100644 --- a/structs.go +++ b/structs.go @@ -14,6 +14,24 @@ type BoundingBox struct { halfDimension float64 } +// quadtree defining the whole quadtree and a node in itself (recursively) +type quadtree struct { + // general information (node capacity, spacial outreach) + nodeCapacity int + boundary BoundingBox + + // slice storing the star coordinates + pointsSlice []Coord + + // the quadtree leaves + northWest *quadtree + northEast *quadtree + southWest *quadtree + southEast *quadtree + + depth int +} + // newCoord returns a new coordinate using the given values func NewCoord(x float64, y float64) Coord { return Coord{x, y} @@ -49,24 +67,6 @@ func (point Coord) InsideOf(quadtreeCell *quadtree) bool { return false } -// quadtree defining the whole quadtree and a node in itself (recursively) -type quadtree struct { - // general information (node capacity, spacial outreach) - nodeCapacity int - boundary BoundingBox - - // slice storing the star coordinates - pointsSlice []Coord - - // the quadtree leaves - northWest *quadtree - northEast *quadtree - southWest *quadtree - southEast *quadtree - - depth int -} - // NewQuadtree returns a new quadtree func NewQuadtree(boundary BoundingBox, depth int) *quadtree { return &quadtree{ -- cgit 1.4.1