Arcs.

 

Let's create an array of the arcs with centers lying on a circle.

 

Let the variation interval of the angle moving along the circle be from 0 to Pi.

Let the variation angle step be equal to 0.8 radians.

 

We'll draw arcs from three points - two end points and the one lying on the arc.

The end points will lie on a circle with the Z center coordinate equal to 0 and radius equal to 5, and the arc middle point will lie on a circle with the Z center coordinate equal to 3 and radius equal to 7.

 

Let's calculate the color, thickness and styles of the arcs on the following formulas:

arc color number from palette =  residue of division integer part (10*angle) by 200+50;

arc thickness = residue of division integer part (10*angle) by 5;

arc style number =  residue of division integer part (10*angle) by 5;

 

 

So, the function of creating the necessary line segments array will look like this:

 

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

 {

   SG_POINT   arP1 = {5.0*cos(i),5.0*sin(i),0.0};

   SG_POINT   arP2 = {5.0*cos(i+0.4),5.0*sin(i+0.4),0.0};

   SG_POINT   arP3 = {7.0*cos(i+0.2),7.0*sin(i+0.2),3.0};

   SG_ARC     arGeo;

  if (arGeo.FromTreePoints(arP1, arP2, arP3,false))

   {

     sgCArc* ar = sgCreateArc(arGeo);

    if (ar)

     {

       sgGetScene()->AttachObject(ar);

       ar->SetAttribute(SG_OA_COLOR,((int)(10*i))%200+50);

       ar->SetAttribute(SG_OA_LINE_THICKNESS, ((int)(10*i))%5);

       ar->SetAttribute(SG_OA_LINE_TYPE, ((int)(10*i))%5);

     }

   }

 }

 

See also:

sgCArc   sgCArc::Create SG_ARC sgGetScene sgCScene::AttachObject   sgCObject::SetAttribute

 

Illustration:

arcs