THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/08/2004 at 11:45, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.503
Platform: Windows ;
Language(s) : C++ ;
---------
Here is the method that I'm using to 'weld' two PolygonSelections together (no change of vertices - just reassigning indices of duplicate points) :
// Weld Geometry (remove seams)
void PoserCharacter::WeldGeometry(void)
{
ParentChild *w;
PoserBase *c, *p;
LONG seg,i,a,b,seg2,j,a2,b2;
LONG *fi, *fj, *fid, *fjd;
Polygon* polys;
Vector* verts;
BaseSelect *bs, *bs2;
SelectionTag *group, *group2;
polys = (static_cast<PolygonObject*>baseObject)->GetPolygon();
verts = (static_cast<PolygonObject*>baseObject)->GetPoint();
for (w = weld; w != NULL; w = (ParentChild* )w->GetNext())
{
if ((c = w->GetChild()) == NULL) continue;
if ((group = c->GetGroup()) == NULL) continue;
if ((p = w->GetParent()) == NULL) continue;
if ((group2 = p->GetGroup()) == NULL) continue;
bs = group->GetBaseSelect();
bs2 = group2->GetBaseSelect();
seg=0;
while (bs->GetRange(seg++,&a;,&b;))
{
for (i=a; i<=b; ++i)
{
seg2=0;
while (bs2->GetRange(seg2++, &a2;, &b2;))
{
for (j = a2; j<=b2; ++j)
{
for (fi = &(polys _.a), fid = fi+5; fi != fid; fi++)
{
for (fj = &(polys[j].a), fjd = fj+5; fj != fjd; fj++)
{
if ((*fi != *fj) && (verts[*fi] == verts[*fj])) *fj = *fi;
}
}
}
}
}
}
}
}
Is there a better way to do this? :)
Thanks,
Robert