From e43386898c6af97a9b6321993b38e6455eadabd6 Mon Sep 17 00:00:00 2001 From: hanemile Date: Sat, 3 Nov 2018 18:01:21 +0100 Subject: Implemented some Examples, these will be visible in the godoc.org documentation! --- structs_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/structs_test.go b/structs_test.go index 5b00aa5..ae4ed35 100644 --- a/structs_test.go +++ b/structs_test.go @@ -127,7 +127,24 @@ func TestInsert(t *testing.T) { t.Logf("Complete Tree: %v\n", newQuadtree.northEast.southWest.southWest.northEast) } +// Example demonstrating the NewCoord() function func ExampleNewCoord() { fmt.Println(NewCoord(1, 1)) // Output: {1, 1} } + +// Example demonstrationg the NewBoundingBox() function +func ExampleNewBoundingBox() { + fmt.Println(NewBoundingBox(NewCoord(0, 0), 10)) + // Output: {{0, 0}, 10} +} + +// Example using the InsideOf() method to test if a point is inside of a quadtre-cell +func ExampleInsideOf() { + var point Coord = NewCoord(0, 0) + var bounadry BoundingBox = NewBoundingBox(NewCoord(0, 0), 10) + var quadtreeCell *Quadtree = NewQuadtree(bounadry, 0) + + fmt.Println(point.InsideOf(quadtreeCell)) + // Output: true +} -- cgit 1.4.1