Jump to content

create lines from point cloud to center point


logix1390

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

Link to comment
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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...