find primGroup center faster

   3150   4   1
User Avatar
Member
303 posts
Joined: May 2007
Offline
when i want delte groups by the group center, i found two way: copy_stamp and foreach, but both way are too slow,is there other methord to do it?

here is a hip showing what i want!

Attachments:
primgroup_control.hip (113.6 KB)

https://vimeo.com/user3971456/videos [vimeo.com]
User Avatar
Member
519 posts
Joined:
Offline
Is this what you are after?

You can use a primitive attribute prim(“../mountain1”, $PR, “P”, 0) which, according to the help, provides the X component of the centroid (or the barycenter, not sure, see this post: http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=19407 [sidefx.com] )

After that just a delete sop and it is waaay faster than copy-stamping and for eaches

Attachments:
primgroup_control_284.hip (119.0 KB)

User Avatar
Member
303 posts
Joined: May 2007
Offline
Pagefan
Is this what you are after?

You can use a primitive attribute prim(“../mountain1”, $PR, “P”, 0) which, according to the help, provides the X component of the centroid (or the barycenter, not sure, see this post: http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=19407 [sidefx.com] )

After that just a delete sop and it is waaay faster than copy-stamping and for eaches

thank you for your reply,but $PR finds every prim value, what i need is each group's value
https://vimeo.com/user3971456/videos [vimeo.com]
User Avatar
Member
8637 posts
Joined: July 2007
Offline
what about this?
precomputing Group Center as Primitive attribute before mountain SOP
so the foreach or copy will process only once
then after mountain delete by this attribute

it will work for your example since mountain is not moving pieces in X but if you
want centers to update according to deformation you'll probably need other solution like:

creating points for each group center, then deform, then delete groups whose corresponding point meets the criteria

look at the attached file for both methods
they are realtime now (after a few seconds of waiting for preprocess)

Attachments:
primgroup_control_fix.hip (451.6 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
303 posts
Joined: May 2007
Offline
tamte
what about this?
precomputing Group Center as Primitive attribute before mountain SOP
so the foreach or copy will process only once
then after mountain delete by this attribute

it will work for your example since mountain is not moving pieces in X but if you
want centers to update according to deformation you'll probably need other solution like:

creating points for each group center, then deform, then delete groups whose corresponding point meets the criteria

look at the attached file for both methods
they are realtime now (after a few seconds of waiting for preprocess)


thank you very much!
it's helpful for me
https://vimeo.com/user3971456/videos [vimeo.com]
  • Quick Links