Orienting points and lines of a 3D grid

calendar_today

13.01.2023

label

Modeling

mouse

Houdini 19.5

Description

Orienting points of three-dimensional grids for copying doors and walls to knots as well as hallways and elevators to pipes.

1 Discussion

Group expression nodes are used to randomly remove line segments of the grid:

CPP
        rand(@elemnum, chi('seed')) < chf('chance')
    

Left-over elements are filtered out by counting the specific connectivity class number:

CPP
        i@num = findattribvalcount(0, 'prim', 'class', i@class);
    

Only primitives with the maximum count are kept:

CPP
        @num==`detail(0, 'num_max', 0)`
    

Line segments are converted to points oriented by the bounding information of the lines:

C
        float b[] = primintrinsic(0, 'bounds', i@primnum);
vector dir = set(b[0]-b[1], b[2]-b[3], b[4]-b[5]);
vector nml = normalize(abs(dir));

int pt = addpoint(0, v@P);
setpointattrib(0, 'N', pt, nml, 'set');
setattribtypeinfo(0, 'point', 'N', 'normal');

removeprim(0, i@primnum, 1);
    

The resulting points are named "elevator" or "hallway" by their vertical or horizontal orientation:

C
        int cond = v@N.y > 0.1;

string name = "none";
if(cond == 1) name = "elevator";
else{ name = "hallway"; }

s@name = name;
    

An octahedron is copied to each knot. Its points are named "door" or "wall" depending on their immediate proximity towards the grid lines:

C
        int cond = xyzdist(1, v@P) < 1e-2;

string name = "none";
if(cond == 1) name = "door";
else{ name = "wall"; }

s@name = name;
    

At last a copy-to-points node assigns objects named "elevator", "hallway", "door" or "wall" to their respective target points.

download

Downloads

link

Related articles

favorite

141

label

Modeling

Adaptive Resampling of Curves

favorite

286

label

Modeling

Applying Scales to Mesh Surfaces

favorite

229

label

Modeling

Approximating subdivision surfaces

favorite

192

label

Modeling

Blending COPs SDFs into 3D Volume

favorite

274

label

Modeling

Branching Subdivision Curves

favorite

130

label

Modeling

Circuit Networks