Solids of revolution.


Let's create a solid of revolution. A closed spline will be the rotated contour.


This code creates a spline:


    SG_POINT tmpPnt;

 SG_SPLINE* spl2 = SG_SPLINE::Create();

 int 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;






 sgCSpline* spl2_obj = sgCreateSpline(*spl2);







Let's rotate the contour around the axis lying on the (10, 10, 0) and (20, 15, 0) points. The rotation angle will be 290 degrees:


 SG_POINT p1 = {10,10,0};

 SG_POINT p2 = {20,15,0};


 sgC3DObject* rO = (sgC3DObject*)sgKinematic::Rotation(*spl2_obj,p1,p2,290,true);





Then we'll move the obtained solid:


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







See also:


sgCSpline   sgCSpline::Create SG_SPLINE

sgGetScene sgCScene::AttachObject   sgCObject::SetAttribute