Comments (3)
Hey. I will have a look at getting that functionality in but I have limited capacity to get this done.
In case you need a quick solution that's relatively inexpensive you can use a hash map.
import org.openrndr.application
import org.openrndr.extra.kdtree.kdTree
import org.openrndr.extra.noise.scatter
fun main() {
application {
program {
val p = drawer.bounds.scatter(100.0)
val kd = p.kdTree()
val indices = p.withIndex().associate { it.value to it.index }
extend {
val nearestIndices = kd.findKNearest(mouse.position, 3).map { indices[it] ?: error("mystery point") }
}
}
}
}
from orx.
Hello @edwinRNDR ,
We would also be interested in this kind of feature since for us finding which index corresponds to the outputed nearest neighbors x,y,z is not stable and a pain at the moment. It would be much more efficient and stable if the lib could return the indexes.
Any chance this could be added to the lib?
Cheers
from orx.
Thank you @edwinRNDR , we were getting unstable hashmap due to the key we were using (we tried using maps of maps with double as key and we also tried to have a list of double as key) but we didn't try a data class with the x,y,z.
We tested your map approach and it is super stable thanks to the data class hashcode stability.
Thank you for your quick response this was very helpful.
Cheers!
PS: I can help contribute to this repo to add the indices, won't have time now but in a few months I will be more free to contribute.
from orx.
Related Issues (20)
- kinect support broken after migration to orx-jvm
- [orx-camera] Bring back Camera2D
- [orx-gui] click events outside gui has `propagationCancelled` == true HOT 6
- ORX 0.4.1 HOT 2
- [orx-gui] Make `gui.shutdown()` clean up after itself HOT 3
- ORX 0.4.2 HOT 2
- [orx-gui] `gui.add(linearGradient)` fails when using OKLab colors HOT 1
- Cannot find FFmpeg artefact on Mac x86_64 HOT 1
- How to add to my project? HOT 2
- orx-shapes does not declare Delaunator dependency HOT 1
- [orx-color] OKHSL and XSLUV gradient not showing correct colors HOT 1
- [orx-gui] Collapsed GUI intercepts and handles some mouse and keyboard events
- [orx-gui] Rendering issues after maximizing window
- MIDI Connection Delay HOT 2
- Introduce module categorization HOT 2
- Bug report: Loading dds image fails HOT 1
- Bug report: the DemoTessShader0?.kt demos fail to run
- ORX 0.4.3
- [orx-camera] OrbitalCamera.isolated is missing a call to update() HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from orx.