# Clustering Objects individually

## Recommended Posts

Hi guys i would like to cluster my objects individually right now it clusters all the nearby pieces that not even the same object (no connectivity) is that a way to solve this without using for each ?

thanks!

Edited by wreath

##### Share on other sites

you could just separate the 2 pieces before the rbdcluster SOP:
Cluster_Problem_2.hiplc
or you can make your own clusters:
Cluster_Problem_3.hiplc

Edited by bunker
• 1

##### Share on other sites

You can cluster per piece by making sure copy numbers are matching between primitives and cluster points.

// primitive wrangle
int pts[] = nearpoints(1, v@P, 1.0);

i@cluster = -1;
foreach(int pt; pts){
if(point(1, 'copynum', pt) == i@copynum){
i@cluster = pt;
break;
}
}

voronoi_per_piece.hipnc

• 2

##### Share on other sites
12 hours ago, bunker said:

you could just separate the 2 pieces before the rbdcluster SOP:
Cluster_Problem_2.hiplc
or you can make your own clusters:
Cluster_Problem_3.hiplc

3 hours ago, konstantin magnus said:

You can cluster per piece by making sure copy numbers are matching between primitives and cluster points.

// primitive wrangle
int pts[] = nearpoints(1, v@P, 1.0);

i@cluster = -1;
foreach(int pt; pts){
if(point(1, 'copynum', pt) == i@copynum){
i@cluster = pt;
break;
}
}

Thanks a lot for the setups guys those will do that job! cheers

##### Share on other sites
15 hours ago, konstantin magnus said:

You can cluster per piece by making sure copy numbers are matching between primitives and cluster points.

// primitive wrangle
int pts[] = nearpoints(1, v@P, 1.0);

i@cluster = -1;
foreach(int pt; pts){
if(point(1, 'copynum', pt) == i@copynum){
i@cluster = pt;
break;
}
}

Konstantin hi again i need a bit more help on the file and did not wanted to create a new topic

How can I create a new name attribute based on those created clusters just like the "cluster sop" does ? Because right now if i send these to a dop sim its recognized as individual chunks instead of clusters..

##### Share on other sites
7 hours ago, wreath said:

How can I create a new name attribute based on those created clusters

s@name = 'cluster_' + itoa(pt);

• 1

##### Share on other sites
14 hours ago, konstantin magnus said:

s@name = 'cluster_' + itoa(pt);

Thanks a lot!

## Create an account

Register a new account