Connecting Nearest Y axis point in point cloud

   Views 442   Replies 2   Subscribers 1
User Avatar
Member
1 posts
Joined: Nov. 2024
Offline
Hi All,

I am relatively new to Houdini, and am trying the connect points to their nearest y neighbour vertically. The points aren't perfectly aligned. I have attached a quick sketch (with red markup) to show the desired connections. Connect adjacent points connects to the x,z points as these are closest (attached.

Any suggestions would be greatly appreciated.

Thanks


Attachments:
Desired_line_connection.png (94.9 KB)
Adjacent_Peices_Undesired_Outcome.png (232.2 KB)

EdG
User Avatar
Member
4827 posts
Joined: Feb. 2012
Offline
Hi,

Here is one way:

int pts [ ] = pcfind ( 0, "P2", v@P2, ch("radius"), chi("maxpts") );
int foundpts [ ] = array ( );
foreach ( int pt; pts )
{
    int id = point ( 0, "class", pt );
    if ( i@class != id )
    {
        append ( foundpts, pt );
        break;
    }
}

if ( len ( foundpts ) > 0 )
    addprim ( 0, "polyline", @ptnum, foundpts [ 0 ] );


Attachments:
1.png (700.2 KB)
2.png (998.6 KB)

Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
User Avatar
Member
52 posts
Joined: March 2017
Offline
A simple global approach would be to crank up the radius and max points on the connect adjacent points then iterate over the polylines to delete any that are below your desired threshold of verticality.

Far less precise but might get you close to what you need.
Edited by pixelninja - March 22, 2025 01:24:40
  • Quick Links