diff options
author | hanemile <hanemile@protonmail.com> | 2018-11-03 17:53:11 +0100 |
---|---|---|
committer | hanemile <hanemile@protonmail.com> | 2018-11-03 17:53:11 +0100 |
commit | e153a00a6031cc52e5f69c2b76d56ebd438af267 (patch) | |
tree | e1d334efc233d764b4e6221ba87741251d40e064 | |
parent | 1ecde651aec890c30bcbc3db79ce202fc323266e (diff) |
moved the quadtree to the top of the file
-rw-r--r-- | structs.go | 36 |
1 files 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{ |