Splines.

 

Let's create two splines.

 

The first spline won't be flat and closed. Its knots will lye on circles with different radii which Z coordinates will be 1 and -1 one after another.

 

The color of the first spline will be number 10 from the palette, line thickness will be 2:

 

  SG_SPLINE* splGeo_1 = SG_SPLINE::Create();

 SG_POINT tmpPnt;

 

int fl=0;

for (double i=0.0;i<2.0*3.14159265;i+=0.4)

 {

   tmpPnt.x = ((double)(fl%3))*cos(i);

   tmpPnt.y = ((double)(fl%3))*sin(i);

   tmpPnt.z = (fl%2)?1.0:-1.0;

   splGeo_1->AddKnot(tmpPnt,fl);

   fl++;

 }

 sgCSpline* spl1_obj = sgCreateSpline(*splGeo_1);

 spl1_obj->SetAttribute(SG_OA_COLOR,10);

 spl1_obj->SetAttribute(SG_OA_LINE_THICKNESS, 2);

sgGetScene()->AttachObject(spl1_obj);

 SG_SPLINE::Delete(splGeo_1);

 

The second spline will be flat and closed. Its knots will lye on circles with 2, 3 and 4 radii one after another.

 

The color of the second spline will be number 0 from the palette, line thickness will be 1:

 

  SG_SPLINE* splGeo_2 = SG_SPLINE::Create();

 fl=0;

for (double i=0.0;i<2.0*3.14159265;i+=0.4)

 {

   tmpPnt.x = ((double)(fl%3+2))*cos(i);

   tmpPnt.y = ((double)(fl%3+2))*sin(i);

   tmpPnt.z = 0.0;

   splGeo_2->AddKnot(tmpPnt,fl);

   fl++;

 }

 splGeo_2->Close();

 

 sgCSpline* spl2_obj = sgCreateSpline(*splGeo_2);

 spl2_obj->SetAttribute(SG_OA_COLOR,0);

 spl2_obj->SetAttribute(SG_OA_LINE_THICKNESS, 1);

 sgGetScene()->AttachObject(spl2_obj);

 

 SG_SPLINE::Delete(splGeo_2);

 

See also:

sgCSpline   sgCSpline::Create SG_SPLINE sgGetScene sgCScene::AttachObject   sgCObject::SetAttribute

 

 

 

Illustration:

splines