Attribute to match across inputs

calendar_today

25.06.2022

label

VEX

mouse

Houdini 19.0

Description

Matching attributes from two inputs based on their ID attribute.

1 Example 1

The attribute wrangle can match common attributes from other inputs using the @opinput virtual bindings. Usually this is done based upon identical point numbers. However, there is also a match attribute parameter hidden under the second tab of the attribute wrangle that can be used for matching corresponding IDs. You can find a simple example for both cases in the download section (opinput.hip).

2 Example 2

In this example (match_id.hip) we are going to store a random color array on a single point and assign its values to the points of a grid. But first we bind an ID attribute to all points of the grid.

CPP
        i@id = 1;
    

We also bind an identical attribute with the same integer value to the single point. Also we create an array with as many random colors as we have points on the grid attached to the second input npoints(1).

CPP
        i@id = 1;

v[]@colors = {};
resize(@colors, npoints(1));

foreach(int i; vector clr; @colors){
    v@colors[i] = rand(i);
}
    

Lastly, we assign all vector values from the array to their corresponding points on the grid using @opinput1 and choose their index based on i@ptnum. This only works when the match attribute (which is hidden under the second tab on the attribute wrangle) is set to id and the IDs are identical. Now either of these lines will work.

CPP
        //v@Cd = getcomp(v[]@opinput1_colors, i@ptnum);
v@Cd = v[]@opinput1_colors[i@ptnum];
    
download

Downloads

link

Related articles

favorite

232

label

VEX

Sphere Packing / Dart Throwing Algorithm

favorite

261

label

VEX

Deintersecting spheres with Voronoi

favorite

292

label

VEX

Fitting Planes to Point Clouds

favorite

302

label

VEX

How to analyze VEX code

favorite

140

label

VEX

Monte Carlo Geometry Processing

favorite

133

label

VEX

Predicate Incircles from 3 points