Filtering math nodes?
Does anyone know if it's possible to filter the results of a math node using the filter node? I've seen there are undocumented properties to look up (http://support.nodebox.net/discussions/nodebox-2-3/5392-property-nodes) but I'm wondering if there are others.
For example, if I have two lists of points and I use the distance node to find the distance between each, how would I use the filter node to only output nodes less than a certain number? I'm not sure what to put in the "key" field of the filter node.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by john on 18 Jun, 2018 11:52 PM
Rougeux,
The filter node needs a table key to work with, so the easiest way to solve this is to give it one, by simply making a table.
See example network and screenshot. I use the make_table node to make a table with three columns: node A, node B, and distance. Then all you have to do is filter with "distance" as the key.
Since you now have everything in a table, you can do lookups to recover your nodes (e.g. lookup node A). You can also do sorts, eliminate duplicates with the distinct node, etc. Tables make everything easier.
Another way of doing this would be to hook your distance node to a compare node to generate a list of booleans (e.g. true only if distance greater than 200). You could then feed that list of booleans into a cull node - one cull node for each list of points, both using the same boolean list. One advantage of this approach is that you wouldn't need to do a lookup to recover the points.
Let me know if that solves your problem.
Thanks,
John
2 Posted by rougeux on 19 Jun, 2018 12:44 PM
Thanks, John. I ended up coming to the same solution with the table node. I love the addition of that node. Using a cull node is another interesting solution I'll keep in mind.