Line segments.


Let's create an array of the line segments with a vertex in the coordinates origin and the second vertex lying on a circle.


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

Let the variation angle step be equal to 0.1 radians, and the circle radius with the second line segment vertices be equal to 5.


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

line segment color number from palette =  residue of division integer part (10*angle) by 100;

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

line segment 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.1)


sgCLine* ln = sgCreateLine(0.0, 0.0, 0.0, 5.0*cos(i), 5.0*sin(i), 0.0);



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

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



See also:

sgCLine   sgCLine::Create   sgGetScene sgCScene::AttachObject   sgCObject::SetAttribute