Is there a way to get the lowest Y position among a group of points?

   3812   3   1
User Avatar
Member
6 posts
Joined: Dec. 2018
Offline
I am a beginner of Houdini. Now I would like to get the lowest Y position among a group of points. I have tried a lot, but them don't work. Is there any specialist can help me with that?
I really appreciate it!
User Avatar
Member
731 posts
Joined: Dec. 2006
Offline
Easiest way way is to append an attribute promote to your node. Set it to:
  • Original name: P
  • New class: detail
  • Promotion method: minimum
(This promotes the point position attribute to a “global” detail attribute, in this case using the minimum value)
Now you can access this detail attribute somewhere else using:
  • detail("../nameOfSop","P",1)
    
(This accesses the detail attribute called “P” in the node “nameOfSop” and looks at index 1, (the Y index)).
Edited by mrCatfish - Dec. 3, 2018 16:58:45
Sean Lewkiw
CG Supervisor
Machine FX - Cinesite MTL
User Avatar
Member
50 posts
Joined: Jan. 2018
Offline
If you want min pos of all the points of an object, just use a point wrangle:

vector m = getbbox_min(0);
@P.y = m.y;
Wes
User Avatar
Member
7 posts
Joined: July 2014
Offline
Hi

this will give you the lowest position and the corresponding point number and put it in a group

vector bbmin = getbbox_min(0);
float lowest_y = bbmin.y; //lowest postion in y
setdetailattrib(0,"lowestY",lowest_y,"set");

// find the point number of the lowest y pos
for(int pt = 0; pt<@numpt; pt++){
    if(@P.y ==lowest_y){
        setdetailattrib(0,"lowestPt",@ptnum,"set");
        @Cd = {1,0,0};
        setpointgroup(0,"lowestY",@ptnum,1,"set");
    }
}
Edited by jpoopi - Dec. 18, 2018 05:34:56
  • Quick Links