VEX: I need to cluster some point islands, cluster center...

   1394   4   0
User Avatar
Member
407 posts
Joined: Aug. 2015
Offline
Hello guys,

As you can see in the image below, in a bunch of points islands, I need these things, using VEX:

1) I want to apply random color to each point island (cluster).

2) I want to group each cluster’s (averaged) center points.

I tried several ways without success

I would appreciate any ideas.



Thanks for helping.

Attachments:
Sample_01.jpg (796.0 KB)
Center_Of_Point_Clusters.hip (140.0 KB)

Masoud Saadatmand (MSDVFX)
User Avatar
Member
670 posts
Joined: Sept. 2013
Offline
Hi Masoud, here's a non-VEX way to get started.

Attachments:
Center_Of_Point_Clusters_2.hiplc (176.8 KB)

https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
670 posts
Joined: Sept. 2013
Offline
Grouping centers:

float radius = chf('radius');
int pts_max = chi('max_points');

int handle = pcopen(0, 'P', v@P, radius, pts_max);
vector pos = pcfilter(handle, 'P');
float var = length(v@P - pos);

i@group_center = var < chf('threshold');

Clustering with VEX:
https://forums.odforce.net/topic/27536-jurajs-playground/?do=findComment&comment=176232 [forums.odforce.net]

Attachments:
Center_Of_Point_Clusters_3.hiplc (140.9 KB)

https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
407 posts
Joined: Aug. 2015
Offline
Hi Konstantin,
Awesome!
Thank you very much.

Can you tell me how can I assign a cluster attribute value to each group of them?
Edited by Masoud - Dec. 19, 2021 06:19:50
Masoud Saadatmand (MSDVFX)
User Avatar
Member
670 posts
Joined: Sept. 2013
Offline
The file in the odforce post does set cluster attributes.
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
  • Quick Links