I’m looking for a way to group values into ranges defined by another set of values.
For example - list one contains a dense list of parameters (for a curve closest point). The second list contains a sparse list of parameters (for a curve closest point).
I want to group the first list into branches where the upper and lower limits are defined by the second list.
I realise this is explained poorly - so hopefully the screenshot below will help to explain it better.
Think of it (somewhat) like a histogram, where a range of points gets collected into ‘Buckets’.
My example is simplified - the second list of points will be defined manually based on external parameters, so grouping them other ways isn’t going to help.
I realise I can do this with a series of list items, and larger than, smaller than blocks, but I can’t find a way to make it dynamic…
I’ve tried to implement both solutions, but my actual case has 3 curves, not 1.
I’ve had to make a few tweaks to accomodate this, and I’ve figured most of the problems out, but I have one problem that has me stumped.
For some reason, my points seem to be dissappearing, but somehow, they’re still showing in the point count.
Here, the input points are white, the output points are green - you can see that some output points are missing - even though the point count is the same.
You should probably go with @Erik_Beeren solution, which I think is cleaner (I wasn’t familiar with the Find Domain component).
Just consider if you want to add -inf and +inf at the ends to the “splitting” points list, to make sure you include points at the ends of your curves (I think eg. @Erik_Beeren solution here was omitting some points at the end of the list because of this).
For your issue - I suppose data tree management is the problem here. The easiest solution is to use Graft by Data from TreeFrog plug-in.
I believe the following uses only vanilla components (apart the very last one, Rainbow for coloring the points and fast checking everything to be fine, but you can just delete that component)
this definition relies on the fact that all the points are sorted: if they aren’t this will fail
Looks very similar to my ColorB and ColorJ components that, in turn, were derived from ‘Colourful’ (by HS Kim?). Full source versions (no plugin!) are here:
@inno’s answer provides the basic structure, but I’m still unclear on how to re-order the tree without using Path Mapper since it’s apparently unreliable as @Joseph_Oster pointed out.
I reviewed the video posted, and I understand almost all of it. For me though, Path mapper has been a very helpful tool for re-shaping my data, and it hasn’t caused problems (other then when the input data shape changes).
I’d love a more acceptable solution for re-shaping a tree from {A;B} to {B;A} if possible.
I said it’s “fragile” for the same reason you noted in this post:
Precisely Data trees can easily change in the course of coding.
I haven’t used Path Mapper for more that ten years, yet managed to solve many puzzles and written a lot of GH without it. Maybe “re-shaping a tree from {A;B} to {B;A}” is going down the wrong road. Don’t get stuck in rigid thinking.
P.S. I haven’t followed this thread closely but note that @inno’s answer doesn’t use it, eh?
The original question was related to only the part of the problem that I was struggling with (a minimum problem) - until you mentioned it, Path Mapper was outside that scope.
As expected - There was another way around re-structuring the data. I was previously using that as a simple way to visualise each ‘bucket’ for debugging.
I’ve use a different method to get the result I want for now - no path mapper required.
For explanation (in case you’re interested): @inno’s answer gets me to the step before I need to re-structure the data for it’s final purpose.
To further explain the problem, and why I was trying to restructure the data: the output returns a structure {A;B} where A is the curve, and B is the group (or bucket) of points. However, I actually want to set corresponding values (in my case Z heights) for all corresponding buckets (B) for each curve (A). So as long as I can input a list of Z Height (lets call that C) then create a structure with the same shape as {A;B}, but containing only the heights (C), then I can work with it
Sorry, I’m not interested. All that “talk” about A and B makes my head spin. Guess I’m less theoretical and more of a practical engineer. That’s why I finally gave up on fourth quarter calculus in college (long ago) - it got too theoretical for me.