Jump to content
Sign in to follow this  
logix1390

create lines from point cloud to center point

Recommended Posts

Hello

I have a bit of an interesting problem. I have a bunch of small point clouds and I want to create a line from each point to the center point. Each point cloud has its own id. The center point has a matching id . I thought using an addprim function would do the trick but its not working... I have something like this:
 

if(i@id==i@idt){
   int prm = addprim(0, "polyline", i@id, i@idt);
   int vtx = addvertex(0, prm, @ptnum);
   
}

I will attach my file for anyone that wants to take a look.

Thanks

create_line_point_cloud.hip

Share this post


Link to post
Share on other sites

Hi,

your id and idt attributes do nothing, you forgot to define them. But it can work even now if you do two things:

1. Change order of inputs on the merge6 node - from CENTER  first and from PT_CLOUD second.

2. Past into "create_lines_..." wrangle this code:

int count = findattribvalcount(0, "point", "sourcept", @ptnum);
if(count > 0) {
    int pts[] = findattribval(0, "point", "sourcept", @ptnum);
    foreach(int pt; pts) {
        int prm = addprim(0, "polyline", @ptnum, pt);
    }
}

After these changes it should work

  • Thanks 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×