find out which group a point belongs to

   4510   2   2
User Avatar
Member
27 posts
Joined: July 2005
Offline
Hi all, I want to find out in which point group a point is. I can't find such a command or is there a command for this?
if no, i think i'll have to loop through the existing groups and check whether a specified group contains my point…which seems to be a lot more work.

I also want to know whether i can use vex to determine what points a point group contains, i can't find a pointgrouplist equilvalent in vex.

Wesley
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
If you want to querry a single point in a SOP and as quickly as you can find out what group it's in, you have to loop through all the points or loop through all the groups. Generally there will be less groups than points so I usually do a foreach loop on all the groups currently present then querry to see if my point in question is in any of the groups.
Expressions you need are foreach(), haspoint(), hasprim(), pointgrouplist(), primgrouplist().


Another approach to find out immediately what group a single point belongs to is to add a string attribute that contains the group name or some other index. If it makes sence to build the groups from the attribute, that would be ideal. If you have to build the attribute from the group, then also not so bad.
If you need to build string attributes from existing groups, look at the expressions pointlist(). That and hope that each point exists in only one group.

If you find out that you can use attributes first then create your groups based on those attributes (I do this as often as I can) then use the Partition SOP to create the groups based on your attributes if you really need the groups.
There's at least one school like the old school!
User Avatar
Member
27 posts
Joined: July 2005
Offline
hi Jeff, really thanks for your reply and the ideas. In my case, the groups are all there and they are built with the partition sop, so I can query the attribute for my point and then know which group it's in,…but I was just hoping a really quick way and thought that I might have missed such a command. Also, I was trying to build tools that can be more useful in general, so I think having a function like whichpointgroup() would be nice and more convenient.
  • Quick Links