Ellipsoids.

 

Let's create an array of the ellipsoids lying on the same line but having different parameters and randomly turned in space:

 

 for (int i=3;i<10;i++)

 {

   sgCEllipsoid* ell1 = sgCreateEllipsoid(i,i/6+2,2*i, 24,24);

   SG_POINT rotCen = {0.0,0.0,0.0};

   SG_VECTOR rotDir = {rand(),rand(),rand()};

   ell1->InitTempMatrix()->Rotate(rotCen,rotDir, rand()*360);

   SG_VECTOR transV1 = {10*i,10,10};

   ell1->GetTempMatrix()->Translate(transV1);

   ell1->ApplyTempMatrix();

   ell1->DestroyTempMatrix();

 

   sgGetScene()->AttachObject(ell1);

   ell1->SetAttribute(SG_OA_COLOR,i);

 }

 

See also:

 

sgCEllipsoid   sgCEllipsoid::Create

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

 

Illustration:

ells