3D object surface and plane intersection contours.

 

Let's create a set of groups of line segments by intersecting the surface of a torus and a set of surfaces.

 

The code of creating a torus and drawing clips:

 

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

 sgGetScene()->AttachObject(tor1);

 

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

for (int i=-30;i<30;i+=4)

 {

   SG_VECTOR plN;

   plN.x =0.0; plN.y = 1.0; plN.z = 1.0;

 

   sgCGroup* bool1 = sgBoolean::Section(*tor1, plN, 0.1*i );

 

  if (bool1)

   {

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

     bool1->ApplyTempMatrix();

     bool1->DestroyTempMatrix();

     sgGetScene()->AttachObject(bool1);

     bool1->SetAttribute(SG_OA_COLOR,i+50);

     bool1->SetAttribute(SG_OA_LINE_THICKNESS,2);

   }

 }

 

 

See also:

sgBoolean   sgBoolean::Section

sgCGroup     sgCGroup::BreakGroup   sgCGroup::GetChildrenList

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

 

Illustration:

bool_pl_sec