Jump to content

Recommended Posts

Hi everybody, 

I'm quite new to Houdini so I have a problem here. I have a group of points on a geometry. Now I want to find the center point of it so I can 'Copy to Point' a sphere. The geometry is an animated alembic cache.

find centerPoint.PNG

find centerPoint.hipnc

BAZA_GUN.abc

Share this post


Link to post
Share on other sites

Hi Doanh,

the attribute promote SOP can calculate the average of an (position) attribute. And a VEX solution would be to expandpointgroup():

int pts[] = expandpointgroup(0, 'group2');
vector pos_avg = vector(0.0);
foreach(int pt; pts){
    pos_avg += point(0, 'P', pt);
}
pos_avg /= len(pts);

addpoint(0, pos_avg);

 

find centerPoint_KM.hipnc

Share this post


Link to post
Share on other sites

or use Extract Centroid SOP

also you may need to copute orient to get stable reference frame in case you need it

find_centerPoint_mod.hipnc

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×