haggi Posted December 16, 2014 Share Posted December 16, 2014 Hi, I try to get the centoid of an object in a pointWrangle node. First I added a float3 attribute to the pointWrange and set the values of this attribute to the centroid of my object like: centroid("../myCube", D_X) etc. This works fine, the values are updated. Now I try to use this attribute in my pointWangle code with: `chs("centerAttribx")`. But it seems that this procedure does not update the values in the pointWrange node. My solution is to create a point with an add node set the position of the point to the centroid and plug this node into the second input of my pointWrange node. This works so far, but I'd like to know if there is a more elegant way to get the centroid directly from within a pointWrangleNode. Quote Link to comment Share on other sites More sharing options...
rayman Posted December 16, 2014 Share Posted December 16, 2014 well, chs returns string - in your case chv should work. Quote Link to comment Share on other sites More sharing options...
haggi Posted December 16, 2014 Author Share Posted December 16, 2014 Thanks.... sometimes I feel so stuipd... Quote Link to comment Share on other sites More sharing options...
wick3dParticle Posted December 16, 2014 Share Posted December 16, 2014 Hi Haggi, I was wondering if you could share that file with us. I was under the impression that you can't run Houdini expression language in wrangle nodes, and that you were limited only to VEX. I would love to learn how you got that to work. I have tried using expressions like centroid() in the past, but remember getting errors due to that. Thanks, Ilan Quote Link to comment Share on other sites More sharing options...
pbarua Posted December 18, 2014 Share Posted December 18, 2014 centroid() doesn't work in vex. Create a 3float (or vector) spare parameter on wrangle. use centroid() expression there and then reference that parameter in wrangle using ch() function. Quote Link to comment Share on other sites More sharing options...
wick3dParticle Posted December 18, 2014 Share Posted December 18, 2014 Ah, got it. I think I misread the original post. Thanks Pradeep! ~Ilan Quote Link to comment Share on other sites More sharing options...
rayman Posted December 18, 2014 Share Posted December 18, 2014 (edited) This should work too (VEX only): vector min, max; getbbox(min, max); vector center = (min+max)/2; Edited December 18, 2014 by rayman 4 Quote Link to comment Share on other sites More sharing options...
wick3dParticle Posted December 19, 2014 Share Posted December 19, 2014 Thanks Rayman. Yes, that's what I have been using. ~Ilan Quote Link to comment Share on other sites More sharing options...
Mzigaib Posted February 23, 2017 Share Posted February 23, 2017 What would be the best way to get those initial 'min' and 'max' vectors from the geometry? Thanks. Quote Link to comment Share on other sites More sharing options...
Mikal Posted February 25, 2017 Share Posted February 25, 2017 The min and max vectors are returned by the getbbox() function. In H16... you can get the same result with getbbox_center(). 2 Quote Link to comment Share on other sites More sharing options...
Mzigaib Posted February 26, 2017 Share Posted February 26, 2017 I though I would have to come with the vector min,max myself which really doesn't makes much sense. Thanks! Quote Link to comment Share on other sites More sharing options...
Nicholas Ralabate Posted February 28, 2020 Share Posted February 28, 2020 fwiw, the vex snippet above seems to produce a different value than the extract centroid SOP (which can also create a centroid attribute) Quote Link to comment Share on other sites More sharing options...
nuki Posted February 28, 2020 Share Posted February 28, 2020 promoting P to a detail attribute (by avg, min/max etc.) can be a useful trick too! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.