Boolean union.

 

Let's create a group being a two toruses joining:

 sgCTorus* tor1 = sgCreateTorus(2,1 ,24,24);

 sgCTorus* tor2 = sgCreateTorus(2,0.5 ,24,24);

 SG_VECTOR transV1 = {1,3.5,0};

 tor2->InitTempMatrix()->Translate(transV1);

 tor2->ApplyTempMatrix();

 tor2->DestroyTempMatrix();

 sgGetScene()->AttachObject(tor1);

 tor1->SetAttribute(SG_OA_COLOR,5);

 sgGetScene()->AttachObject(tor2);

 tor2->SetAttribute(SG_OA_COLOR,45);

 

 SG_VECTOR transV2 = {-6.5,0,0};

 

 sgCGroup* bool1 = sgBoolean::Union(*tor1, *tor2);

 

 bool1->InitTempMatrix()->Translate(transV2);

 bool1->ApplyTempMatrix();

 bool1->DestroyTempMatrix();

 sgGetScene()->AttachObject(bool1);

 bool1->SetAttribute(SG_OA_COLOR,3);

 bool1->SetAttribute(SG_OA_DRAW_STATE,SG_DS_FRAME);

 

See also:

sgBoolean   sgBoolean::Union

sgCGroup     sgCGroup::BreakGroup   sgCGroup::GetChildrenList

sgCObject::InitTempMatrix sgCMatrix::Translate   sgCObject::ApplyTempMatrix   SgCObject::DestroyTempMatrix   sgGetScene sgCScene::AttachObject   sgCObject::SetAttribute

 

Illustration:

bool_un