H12 HDK equivalent to GB_Detail::mergeGroup() functions?

   3045   8   0
User Avatar
Member
59 posts
Joined: April 2006
Offline
The HDK porting guide doesn't describe any methodology for doing what the old GB_Detail::mergeGroup() and GB_Detail::mergeGroups() functions used to do. And there don't seem to be any equivalent functions. How do we now copy/merge groups from one Detail to another (GA_ElementGroup::copyMembership() only seems to work between groups within the same Detail).

Thanks!
User Avatar
Staff
1072 posts
Joined: July 2005
Offline
Those missing methods are an oversight, unnoticed because our internal code didn't make use of them.

It's hairy enough that I'll add those methods back, but in the meantime you could use something like the following.


GA_PrimitiveGroup *dest_group = newPrimitiveGroup(src_group->getName(), src_group->getInternal());
if (src_group->getOrdered())
dest_group->makeOrdered();

const GA_IndexMap &dest_map = dest_group->getIndexMap();
const GA_IndexMap &src_map = src_group->getIndexMap();
for (GA_Iterator it(GA_Range(*src_range); !it.atEnd(); it.advance())
{
dest_group->addOffset(dest_map.offsetFromIndex(src_map.indexFromOffset(it.getOffset()));
}
User Avatar
Member
59 posts
Joined: April 2006
Offline
Thank you for the code snippet. One question though. Where is src_range supposed to come from in the expression:

GA_Iterator it(GA_Range(*src_range))
Was that supposed to be src_group?

Thanks!
User Avatar
Staff
1072 posts
Joined: July 2005
Offline
jrcooper
Was that supposed to be src_group?

Yes. Sorry.
User Avatar
Member
59 posts
Joined: April 2006
Offline
If the source and destination geometries are the same, is there any reason this wouldn't work also?

dest_group->addRange(GA_Range(*src_group));
User Avatar
Staff
1072 posts
Joined: July 2005
Offline
While you can assume correspondence by ordered index, you can't assume that both details use the same data offsets for corresponding elements. That is to say, the source offset range might not map to the corresponding elements in the destination.
User Avatar
Staff
1072 posts
Joined: July 2005
Offline
GEO_Detail::mergeGroups() makes an appearance in the next daily build.
User Avatar
Member
59 posts
Joined: April 2006
Offline
Awesome!

Will the new build include the mergeGroup() functions as well? There were originally three in the mergeGroup* family of functions, so to speak:

GB_Detail::mergeGroup(const GB_Detail&, const GB_PointGroup&, int);
GB_Detail::mergeGroup(const GB_Detail&, const GB_PrimitiveGroup&, int);
GB_Detail::mergeGroups(const GB_Detail&, int);

The first two are actually more important to me for my SOP than the third.
User Avatar
Staff
1072 posts
Joined: July 2005
Offline
Yes, the individual group merging methods are there too.
  • Quick Links