RFE: Grouping/Sorting Points in Line Strips and Polygonize POP Options

Hello! Sharing some thoughts about Line Strips and the Polygonize POP (with a little overlap.)

I’ve encountered a few times where I want to manipulate the order of points in a line strip, and the POPs I intuitively grab to do this don’t work.

For instance, today I wanted to group every 2nd point in a circle line strip, with the intention of scaling every other point to generate a star. When I attempt to use a Group SOP with the pattern *:2 no points are added to the group. I was able to achieve the desired results using a Line Divide POP, creating 2 divisions per segment, and then using the “ControlPoint” attribute as a weight for my transform, but it took some thinking to get there, and while it worked for my context I still think the option would be useful in the Group SOP.

Similarly the Sort POP doesn’t work with line strips. A while back I wanted to do a random sort of points in a line strip, and had to find another approach (sorting using CHOPs and feeding them back in does work.) I realized recently that the Primitive POP can also be used for going from a set of points to line strip, but even then it does require an extra step of conversion. I can see why sorting might be an issue when dealing with multiple line strips, though if it’s possible to add the option to sort points per line strip could be useful!

Here’s the .toe for the above in case that’s useful:
LineStripFeedback.toe (6.7 KB)


I was recently playing with the Polygonize POP and found myself wanting more options, both for how it processed the input and what it outputs.

  • For inputs it would be nice to be able to choose what channel is used, similar to the dropdown in a Reorder TOP. One can always use one before the Polygonize POP, though having it built in would be handy.
  • For outputs, I’m interested in the option for outputting continuous line strips. I realize connecting them into continuous strips might be possible using some neighbor / proximity based sorting, though I haven’t attempted it yet.
  • It would be nice if the Polygonize POP showed up contextually when creating a new POP from a TOP source (right now we only have Lookup Texture POP and TOP to POP)
1 Like

About the pattern matching in the Group POP (and Delete POP): There was an overhaul of pattern matching to make it more consistent throughout TouchDesigner. There are legacy modes to preserve older behavior, but in POPs, being a new family, we went all-in with the new syntax.

0-50:2

is now

[0-50:2]

Beside the parameter, the popup menu of suggestions has not been changed, so we need to update that with proper suggestions, sorry.

But what was

*:2

does not work as

[*:2]

so we are in discussions now about if that was an oversight… standby, and thanks for brining that to our attention.

We noted noted the change in the release notes: overhaul and improvement of Pattern Matching for TouchDesigner parameters, some non-backward compatible for POPs like Delete POP’s Pattern page: 3-15 is now [3-15].

We will respond to your other points about sorting and polygonize separately.

About randomly sorting and connecting points per-linestrip. Here is a tricky way of doing it. You have 3 linestrips (2 circles and a star). The idea is to sort the whole point list randomly, but make sure the first linestrip’s points are first in the random list, and the third linestrip’s points are last in the random list, etc…

linemetrics1 adds a LineStripIndex point attribute, which puts on each point the primitive number that the point is member of. So its value is 2 on all the points of the third linestrip.

random1 puts a random number 0-1 on all points. If you add those two attributes into a new attribute RandomByLinestrip and then sort2 sorts by RandomByLinestrip, you get the first linestrip’s points randomly sorted, followed by the second linestrip’s points randomly sorted, etc.

Then lookupattr1 looks up a new P value based on each point’s point index (the built-in attribute _PointI). This guarantees the new P values come from points in the same linestrip.

LineStripFeedback.8.toe (11.7 KB)

For pattern matching like in the Delete and Group POPs, the forms are:

*
[*:4]       (this will be in the next builds)
[0-99]
[0-99:2]
[0-99:2:4]
^[0-99]
[1,4,9,16]
1 Like

Hi Greg,

Thanks for all the responses!

Makes sense re: pattern matching. I had missed the new syntax so that’s good to know.

I hadn’t thought to use the _PointI with the Lookup Attribute POP as a way to quickly replace attributes between two POPs with aligned indices. I knew there was a POP I was missing to get to a clean solution! That method you shared also works for any kind of sort (doesn’t have to be random) as long as the separation is larger than the max number of points (1000 is decently safe, but that could even be increased dynamically based on the input.)