From 6973317cca87bb3ce10ce458a21f650e7f3b4550 Mon Sep 17 00:00:00 2001 From: skell999 Date: Thu, 24 Mar 2022 17:14:27 +0000 Subject: [PATCH] Update README.md Updated readme --- README.md | 50 ++++++++++++++++++++++++-------------------------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 3c52a1f..f7dc2e5 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,37 @@ -MyAddon (rename to your addon's name) +ofxSpatialHash ===================================== - -*This is a template of a README file for your addon. Fill in the relevant sections, and it should already give users a pretty good overview over your awesome addon!* -We chose the [Markdown format](http://daringfireball.net/projects/markdown/syntax) since it can present good formatting where available (e.g. on Github) while still staying human-readable with a plain text editor. -Don't forget, before announcing your addon to the world, you should replace `README.md` with this file and remove `README_AUTHOR.md`. - -Introduction ------------- -Describe what your addon is about +Fast nearest neighbour lookup for 2d particle systems License ------- -State which license you offer your addon under. openFrameworks is distributed under the [MIT License](https://en.wikipedia.org/wiki/MIT_License), and you might consider using this for your repository. By default, `license.md` contains a copy of the MIT license to which you can add your name and the year. +[MIT License](https://en.wikipedia.org/wiki/MIT_License) Installation ------------ -Any steps necessary to install your addon. Optimally, this means just dropping the folder into the `openFrameworks/addons/` folder. +Git clone or copy into `openFrameworks/addons/` folder. -Dependencies +Usage ------------ -What other addons are needed to properly work with this one? +#### First use +First initialise the hash with the correct dimensions `ofxSpatialHash::init()`
+Points can be added to the hash with `ofxSpatialHash::addPoint(float x, float y, T value)`
+Search for points `getNearestPoints(float x, float y, float radius)` and test for distance if necessary
-Compatibility ------------- -Which versions of OF does this addon work with? +#### Update points +Clear hash `ofxSpatialHash::clear()`
+Add points `ofxSpatialHash::addPoint(float x, float y, T value)`
-Known issues ------------- -Any specific (and long-living) issues/limitations you want to mention? For bugs, etc. you should use the issue tracker of your addon's repository - -Version history ------------- -It make sense to include a version history here (newest releases first), describing new features and changes to the addon. Use [git tags](http://learn.github.com/p/tagging.html) to mark release points in your repo, too! - -### Version 0.1 (Date): -Describe relevant changes etc. +#### Example +All points contained in the green squares will be returned from a call to `ofxSpatialHash::getNearestPoints(float x, float y, float radius)`
+Users need to test the returned points to see if they are inside the radius with a call to `ofVec2f::distance` or `glm::distaance` +![Example](https://github.com/skell999/ofxSpatialHash/blob/main/docs/example.jpg?raw=true) +Known issues +------------ +- 2d only. +- Points must be positive in x and y. +- The spatial hash top left corner is anchored to 0,0. +- The class needs a predefined space width and height. Points outside this space will cause errors. +- The returned points from a nearest neighbour search will contain points outside of the search radius. +- An extra distance check provided by the user is needed to make sure you have points contained inside the radius.