Filtering math nodes?

rougeux's Avatar

rougeux

18 Jun, 2018 05:52 PM

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.

  1. Support Staff 1 Posted by john on 18 Jun, 2018 11:52 PM

    john's Avatar

    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. 2 Posted by rougeux on 19 Jun, 2018 12:44 PM

    rougeux's Avatar

    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.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

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

Recent Discussions

10 Sep, 2024 03:41 AM
09 Sep, 2024 02:15 PM
07 Sep, 2024 05:16 AM
05 Sep, 2024 02:21 AM
04 Sep, 2024 05:01 AM

 

03 Sep, 2024 10:07 AM
02 Sep, 2024 05:56 AM
31 Aug, 2024 11:07 PM
27 Aug, 2024 12:08 AM
26 Aug, 2024 01:02 PM
26 Aug, 2024 07:18 AM