about summary refs log tree commit diff
diff options
context:
space:
mode:
authorhanemile <hanemile@protonmail.com>2018-11-03 18:01:21 +0100
committerhanemile <hanemile@protonmail.com>2018-11-03 18:01:21 +0100
commite43386898c6af97a9b6321993b38e6455eadabd6 (patch)
tree793321d1d5b95847de79567c31db8521ad632ed7
parentd85773ffda4a6a2602b319cc0ee8ec757cc0042b (diff)
Implemented some Examples, these will be visible in the godoc.org documentation!
-rw-r--r--structs_test.go17
1 files changed, 17 insertions, 0 deletions
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
+}