Group adjacent primitives with similar Normal

   2455   2   2
User Avatar
Member
26 posts
Joined: June 2016
Offline
I would like to group all primitives that are:

* directly adjacent to each other
* share the same normal with x% of possible deviation

My attempts so far worked with finding primitives with the same normal (using the partition sop), however, it's not really optimal and I fail to combine this with only adjacent primitives. Any help is greatly appreciated.
User Avatar
Member
670 posts
Joined: Sept. 2013
Offline
8BitBeard
share the same normal with x% of possible deviation

vector normal = chv('normal');
float threshold = chf('threshold');
// compare user normals against surface normals
float compare = distance(@N, normal);
// assign to group if within threshold
if(compare < threshold){
    setprimgroup(0, "angle_select", @ptnum, 1, "set");
}

8BitBeard
directly adjacent to each other
https://sidefx.com/forum/topic/48424/ [sidefx.com]
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
670 posts
Joined: Sept. 2013
Offline
Regarding adjacent primitives primpoints will tell you what points are connected to the selected prim. feeding those points into a pointsprim function will give you all the prims connected to those points. by comparing the prim normals you can restrict this expansion. put both steps into a for loop to increase the spread.

I attached a little tool that hopefully does the job.
Edited by Konstantin Magnus - April 25, 2017 13:14:46

Attachments:
cont_sel_01.jpg (9.5 KB)
cont_sel_02.jpg (9.4 KB)
group_by_vector_adjacent.hipnc (240.7 KB)

https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
  • Quick Links