VEX comparing if 2 grps are the same (have same primnumbers)

   2496   6   0
User Avatar
Member
42 posts
Joined: March 2019
Offline
Hello,

I want to check if two Groups are the same, so have the exact same primnumbers. Based on that I want to create a detail attribute that is either 1 or 0.
You can see my approach right here.


What my thought was that I Loop Over the primitives and then check if they are within the groups. If so they get assigned to an array . I do this for each group and then compare if the arrays are the same.

It works, but it is really slow.

How can I improve this?
If the way I approached this is simply wrong, how is the right/better way to approach it.

Greetings Lucca
Edited by Lucca - June 11, 2021 09:43:07

Attachments:
code_try.png (69.9 KB)

User Avatar
Member
2660 posts
Joined: June 2008
Offline
What if you use a group combine node? After combining, if the count is the same as either initial group, then they are the same..?
Using Houdini Indie 20.5
Windows 11 64GB Ryzen 16 core.
nVidia 3060RTX 12BG RAM.
User Avatar
Member
875 posts
Joined: Oct. 2008
Offline
Do you want this in vex? Does it have to run over prims or can you be in detail mode?

If not I'd probably isolate the geo by groups and see if they coincide exactly.
--
Jobless
User Avatar
Member
42 posts
Joined: March 2019
Offline
Enivob
What if you use a group combine node? After combining, if the count is the same as either initial group, then they are the same..?

Yeah I see, thats a nice idea! Thanks!
User Avatar
Member
42 posts
Joined: March 2019
Offline
Soothsayer
Do you want this in vex? Does it have to run over prims or can you be in detail mode?

If not I'd probably isolate the geo by groups and see if they coincide exactly.

Well, I would love to see how you can do it in Vex as well just for personal improvement purposes. It can definitely be in detail mode. I am running this code in detail mode too.

Do you mean to isolate the two parts with a blast and then see if the prim count is the same?

Didn't realize that the screenshot was missing a few lines. I updated it now.
Edited by Lucca - June 11, 2021 09:43:34

Attachments:
Screenshot 2021-06-11 153703.png (88.7 KB)

User Avatar
Member
732 posts
Joined: Sept. 2013
Offline
Hi Lucca,

it seems like you can compare arrays based upon groups:

int prims_0[] = expandprimgroup(0, 'group1', 'ordered');
int prims_1[] = expandprimgroup(0, 'group2', 'ordered');
i@match = prims_0 == prims_1;
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
42 posts
Joined: March 2019
Offline
Konstantin Magnus
Hi Lucca,

it seems like you can compare arrays based upon groups:

int prims_0[] = expandprimgroup(0, 'group1', 'ordered');
int prims_1[] = expandprimgroup(0, 'group2', 'ordered');
i@match = prims_0 == prims_1;

Nice, that's amazing. Just converts this unruly mess I've created into 3 Lines. Thank you very much!
  • Quick Links