Point attribute Umap & Umap Half

I've seen in a lot of Houdini tutorials that people often map points along curves with a 0 to 1 attribute for different purposes. I've also found this very useful and here is two hscript expressions I often use for this.

Umap

Simply creates a 0 to 1 attribute based on the point number and number of point

$PT / ($NPT - 1)

Run in the Value parameter of an Attribute Create Sop.

Umap Half

Creates a 0 to 1 to 0 attribute based on the point number and number of point. This is not the prettiest expression but it works. I find this especially useful when creating symmetrical stuff. Before I often found myself creating mirrored ramps to achieve this but with this I only have to create half the ramp. 

clamp($PT / ($NPT - 1), 0, 0.5) * clamp(fit($PT, 0, $NPT - 1, $NPT - 1, 0) / ($NPT - 1), 0, 0.5) * 4

Run in the Value parameter of an Attribute Create Sop.

ForEach

Stamp expressions inside a foreach node.

• Case of using number

stamp("..", "FORVALUE", 0)

• Case of using Group mask

opdigits(stamps("..", "FORVALUE", ""))

Misc

op:`opinputpath("../.", 0)`