Created
June 24, 2019 21:02
-
-
Save eriadam/dc1fb4ca1a7ec12a2b863c192bd0ea57 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Nearest neigbour to a defined point. | |
let nearest = tree.element(nearestTo: float2(0, 0)) | |
/// You may filter for different types (classes) when performing | |
/// a nearest element search. | |
let nearestLocation = tree.element( | |
nearestTo: float2(0, 0), | |
type: CLLocation.self) | |
/// All of the elements in the quadtree node this point would be placed in. | |
let elementsAtPoint = tree.elements(at: float2(0, 0)) | |
/// All of the elements that resides in quadtree nodes which intersect | |
/// the given quad. Recursively check if the earch quad contains the points | |
/// in the quad. | |
let searchQuad = BMQuad( | |
quadMin: float2(-10, -10), | |
quadMax: float2(10, 10)) | |
let elementsInQuad = tree.elements(in: searchQuad) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment