bool   sgCGroup::BreakGroup(sgCObject** objcts)

 

Description:

Takes the group to component parts.

 

Arguments:

objcts - buffer to put the group component parts. You should allocate the memory for an array of objects pointers beforehand. The number of the elements in this array must be equal to the group child objects (returned by GetChildrenList->GetCount()).

 

Returned value:

Returns false if the function fails, otherwise true. The function argument is filled with the pointers to child objects.

 

 

Example:

 

/*Build group*/

sgCObject*   objcts[4];

objcts[0] = sgCreateLine(0.0, 0.0, 0.0, 2.0, 3.0, 5.0);

objcts[1] = sgCreateLine(2.0, 3.0, 5.0, 10.0, 0.0, 3.0);

objcts[2] = sgCreateLine(10.0, 0.0, 3.0, 6.0, 13.0, 15.0);

objcts[0] = sgCGroup::CreateGroup(&objcts[0],3);

objcts[1] = sgCreateBox(6.0, 13.0, 15.0);

objcts[2] = sgCreateSphere(20.0, 24, 24);

objcts[3] = sgCreateLine(10.0, 6.0, -3.0, 0.0, 0.0, 0.0);

sgCGroup* resGroup = sgCGroup::CreateGroup(&objcts[0],4);

 

  /*Break contour*/

const int ChildsCount = resGroup->GetChildrenList()->GetCount();

 

 sgCObject**  allChilds = (sgCObject**)malloc(ChildsCount*sizeof(sgCObject*));

if (!resGroup->BreakGroup(allChilds))

 {

   assert(0);

 }

const int sz = resGroup->GetChildrenList()->GetCount();

 assert(sz==0);

 sgDeleteObject(resGroup);

for (int i=0;i<ChCnt;i++)

 {

      sgGetScene()->AttachObject(allChilds[i]);

 }

 free(allChilds);

 

 

See also:

CreateGroup